Skip to content

Commit

Permalink
script.create_testgroups: Set correct deadline.
Browse files Browse the repository at this point in the history
This makes deadline profiles work again, which gives far more logical
number of deliveries and feedbacks.
  • Loading branch information
espenak committed Jul 24, 2011
1 parent 556a906 commit 3d6a57f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions devilry/scripts/create_testgroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ def create_example_assignmentgroup(assignment, students, examiners,
student=User.objects.get(username=student))
for examiner in examiners:
group.examiners.add(User.objects.get(username=examiner))
fakedeadline = group.deadlines.all()[0]
fakedeadline.deadline = datetime(1970, 1, 1)
group.deadlines.create(deadline=deadline)
logging.info("Created {0} (id:{1})".format(group, group.id))
return group
Expand Down Expand Up @@ -256,14 +258,14 @@ def create_example_deliveries_and_feedback(group, quality_percents,

# More than two weeks since deadline - should have feedback on about all
if deadline < two_weeks_ago:
logging.debug("Very old deadline (14 days +)")
logging.info(" Very old deadline (14 days +)")
if randint(0, 100) <= 3: # Always a 3% chance to forget giving feedback.
return
autocreate_feedbacks(delivery, group_quality_percent, max_percent)

# Less than two weeks but more that 5 days since deadline
elif deadline < five_days_ago:
logging.debug("Old deadline (5-14 days)")
logging.info(" Old deadline (5-14 days)")
if randint(0, 100) <= 10:
# 10% of them has no feedback yet
return
Expand All @@ -272,23 +274,23 @@ def create_example_deliveries_and_feedback(group, quality_percents,
# Recent deadline (2-5 days since deadline)
# in the middle of giving feedback
elif deadline < two_days_ago:
logging.debug("Recent deadline (2-5 days)")
logging.info(" Recent deadline (2-5 days)")
if randint(0, 100) <= 50:
# Half of them has no feedback yet
return
autocreate_feedbacks(delivery, group_quality_percent, max_percent)

# Very recent deadline (0-2 days since deadline)
elif deadline < now:
logging.debug("Very recent deadline (0-3 days)")
logging.info(" Very recent deadline (0-3 days)")
if randint(0, 100) <= 90:
# 90% of them has no feedback yet
return
autocreate_feedbacks(delivery, group_quality_percent, max_percent)

# Deadline is in the future
else:
logging.debug("Deadline is in the future. Made deliveries, but "\
logging.info(" Deadline is in the future. Made deliveries, but "\
"no feedback")
pass # No feedback

Expand Down

0 comments on commit 3d6a57f

Please sign in to comment.