@@ -193,9 +193,9 @@ def serialize_q13(countries):
193
193
writer .append ([country ], [count ])
194
194
195
195
def serialize_q14 (creationdates ):
196
- writer = ParamsWriter ("q14" , ["begin" ,"todoEnd " ])
196
+ writer = ParamsWriter ("q14" , ["begin" ,"end " ])
197
197
for creation , count in creationdates :
198
- writer .append ([str (creation ),str (1278888800000 )], [count ])
198
+ writer .append ([str (creation [ 0 ] ),str (creation [ 1 ] )], [count ])
199
199
200
200
def serialize_q15 (countries ):
201
201
writer = ParamsWriter ("q15" , ["country" ])
@@ -219,11 +219,12 @@ def serialize_q18(post_weeks):
219
219
writer .append ([str (week )], [count ])
220
220
221
221
def serialize_q19 (tagclasses ):
222
+ PERS_DATE = datetime .strptime ("1989-1-1" ,"%Y-%m-%d" )
222
223
writer = ParamsWriter ("q19" , ["date" ,"tagClass1" ,"tagClass2" ])
223
224
for ix in range (0 ,len (tagclasses )):
224
225
tag_class_a , count_a = tagclasses [ix ]
225
226
for tag_class_b , count_b in tagclasses [ix + 1 :]:
226
- writer .append ([str ("1989-1-1" ),tag_class_a , tag_class_b ], [count_a , count_b ])
227
+ writer .append ([str (format_date ( PERS_DATE ) ),tag_class_a , tag_class_b ], [count_a , count_b ])
227
228
228
229
def serialize_q20 ():
229
230
writer = ParamsWriter ("q20" , [])
@@ -322,8 +323,13 @@ def main(argv=None):
322
323
323
324
#post_lower_threshold = (total_posts/(week_posts[len(week_posts)-1][0]/7/4))*0.8
324
325
#post_upper_threshold = (total_posts/(week_posts[len(week_posts)-1][0]/7/4))*1.2
325
- post_lower_threshold = (total_posts / (len (week_posts )/ 4 ))* 0.8
326
- post_upper_threshold = (total_posts / (len (week_posts )/ 4 ))* 1.2
326
+ non_empty_weeks = len (week_posts )
327
+ for ix in range (0 ,len (week_posts )):
328
+ if week_posts [ix ][1 ]== 0 :
329
+ non_empty_weeks -= 1
330
+
331
+ post_lower_threshold = (total_posts / (non_empty_weeks / 4 ))* 0.8
332
+ post_upper_threshold = (total_posts / (non_empty_weeks / 4 ))* 1.2
327
333
post_months = post_month_params (week_posts , post_lower_threshold , post_upper_threshold )
328
334
329
335
serialize_q2 (country_sets , post_day_ranges )
0 commit comments