~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/database.py

  • Committer: Matt Giuca
  • Date: 2010-07-20 13:38:52 UTC
  • mto: This revision was merged to the branch mainline in revision 1818.
  • Revision ID: matt.giuca@gmail.com-20100720133852-b4xvxuwpb8wljgop
database: Added ProjectSubmissions.days_late for more info.
Project page: Now shows the number of days late (rounded up) for any late submissions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
954
954
    @property
955
955
    def late(self):
956
956
        """True if the project was submitted late."""
 
957
        return self.days_late > 0
 
958
 
 
959
    @property
 
960
    def days_late(self):
 
961
        """The number of days the project was submitted late (rounded up), or
 
962
        0 if on-time."""
957
963
        # XXX: Need to respect extensions.
958
 
        return self.date_submitted > self.assessed.project.deadline
 
964
        return max(0,
 
965
            (self.date_submitted - self.assessed.project.deadline).days + 1)
959
966
 
960
967
# WORKSHEETS AND EXERCISES #
961
968