Changeset 1985


Ignore:
Timestamp:
09/11/07 10:40:46 (12 years ago)
Author:
pjotr
Message:

References #1512, changed the age range generation a bit plus some other small changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/utilities/scam-export.py

    r1983 r1985  
    5252 
    5353# Target groups and ages 
    54 targ_groups = {'pre-school education':'U-6','1st grade':'6-7','2nd grade':'7-8','3rd grade':'8-9','4th grade':'9-10','5th grade':'10-11','6th grade':'11-12','7th grade':'12-13','8th grade':'13-14','9th grade':'14-15','10th grade':'15-16','11th grade':'16-17','12th grade':'17-18','higher education':'18-U','adult education':'18-U','teachers':'21-65','special education':'6-19'} 
     54targ_groups = {'pre-school education':'U-6','1st grade':'6-8','2nd grade':'7-8','3rd grade':'8-10','4th grade':'9-11','5th grade':'10-12','6th grade':'11-13','7th grade':'12-14','8th grade':'13-15','9th grade':'14-16','10th grade':'15-17','11th grade':'16-18','12th grade':'17-19','higher education':'18-U','adult education':'18-U','teachers':'21-65','special education':'6-19'} 
    5555 
    5656def generateCSVfile(lemill_id,portal_url): 
     
    6565        fields = [] 
    6666        # Add Identifier catalog * 
    67         fields.append('lemill') 
    68  
     67        fields.append(identifier_catalog) 
    6968        # Add Identifier entry * 
    7069        fields.append(result.UID) 
     
    8887        fields.append(subjs) 
    8988        # Add Keyword 
    90         # Tags list needs to be transformed into a string 
    9189        tags_res = result.getTags 
    9290        tags = ','.join(tags_res) 
     
    103101            v = targ_groups[category].split('-')[0] 
    104102            if v=='U': return 'U' 
    105             elif current_min==None: return v 
    106103            elif current_min=='U': return 'U' 
     104            v=int(v) 
     105            if current_min==None: return v 
    107106            return min(v,current_min) 
    108107        def getMaximum(category,current_max): 
    109108            v = targ_groups[category].split('-')[1] 
    110109            if v=='U': return 'U' 
    111             elif current_max==None: return v 
    112110            elif current_max=='U': return 'U' 
     111            v=int(v) 
     112            if current_max==None: return v 
    113113            return max(v,current_max) 
    114114        minage=maxage=None 
     
    120120             
    121121        if minage==None: 
     122            # XXX Or should that just be Undefined default: "U-U" 
    122123            fields.append('') 
    123124        else: 
    124             fields.append('-'.join((minage,maxage))) 
     125            fields.append('%s-%s' % (minage,maxage)) 
    125126        # Add Description of rights 
    126127        fields.append(license_link) 
Note: See TracChangeset for help on using the changeset viewer.