Changeset 3107


Ignore:
Timestamp:
11/14/10 22:34:39 (9 years ago)
Author:
jukka
Message:

More accurate but a bit slower front page stats.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LeMillTool.py

    r3077 r3107  
    924924        week_ago={'query': self.ZopeTime()-7, 'range':'min'} 
    925925        d={'teachers':0, 'countries':0,'learning_resources':0,'languages':0,'weekly_members':0,'weekly_new':0,'weekly_edited':0} 
    926         d['teachers']=len(pc({'portal_type':'MemberFolder', 'getState':'public'})) 
    927         d['countries']=len(pc.uniqueValuesFor('getLocation_country'))-2 # 'No country specified' and another empty field marker shouldn't count 
    928         d['learning_resources']=len(pc({'portal_type':MATERIAL_TYPES + ACTIVITY_TYPES + TOOLS_TYPES, 'getState':'public'})) 
    929         d['languages']=len(pc.uniqueValuesFor('Language'))-2 # same as with countries 
     926        teachers=pc({'portal_type':'MemberFolder', 'getState':'public'}) 
     927        d['teachers']=len(teachers) 
     928        d['countries']=len(pc.fastCount(teachers, 'getLocation_country'))-2 # 'No country specified' and another empty field marker shouldn't count 
     929        resources=pc({'portal_type':MATERIAL_TYPES + ACTIVITY_TYPES + TOOLS_TYPES, 'getState':'public'}) 
     930        d['learning_resources']=len(resources) 
     931        d['languages']=len(pc.fastCount(resources,'Language'))-2 # same as with countries 
    930932        d['weekly_members']=len(pc({'portal_type':'MemberFolder', 'getState':'public', 'created':week_ago})) 
    931933        d['weekly_new']=len(pc({'portal_type':MATERIAL_TYPES + ACTIVITY_TYPES + TOOLS_TYPES, 'getState':'public', 'created':week_ago})) 
Note: See TracChangeset for help on using the changeset viewer.