Skip to content

Commit d548b17

Browse files
committed
2 parents 1591925 + fe2a916 commit d548b17

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

paramgenerator/generateparamsbi.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ def serialize_q13(countries):
193193
writer.append([country], [count])
194194

195195
def serialize_q14(creationdates):
196-
writer = ParamsWriter("q14", ["begin","todoEnd"])
196+
writer = ParamsWriter("q14", ["begin","end"])
197197
for creation, count in creationdates:
198-
writer.append([str(creation),str(1278888800000)], [count])
198+
writer.append([str(creation[0]),str(creation[1])], [count])
199199

200200
def serialize_q15(countries):
201201
writer = ParamsWriter("q15", ["country"])
@@ -219,11 +219,12 @@ def serialize_q18(post_weeks):
219219
writer.append([str(week)], [count])
220220

221221
def serialize_q19(tagclasses):
222+
PERS_DATE=datetime.strptime("1989-1-1","%Y-%m-%d")
222223
writer = ParamsWriter("q19", ["date","tagClass1","tagClass2"])
223224
for ix in range(0,len(tagclasses)):
224225
tag_class_a, count_a = tagclasses[ix]
225226
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])
227228

228229
def serialize_q20():
229230
writer = ParamsWriter("q20", [])
@@ -322,8 +323,13 @@ def main(argv=None):
322323

323324
#post_lower_threshold = (total_posts/(week_posts[len(week_posts)-1][0]/7/4))*0.8
324325
#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
327333
post_months = post_month_params(week_posts, post_lower_threshold, post_upper_threshold)
328334

329335
serialize_q2(country_sets, post_day_ranges)

0 commit comments

Comments
 (0)