Ran update-copyright.py.
[pygrader.git] / pygrader / model / grade.py
1 # Copyright (C) 2012 W. Trevor King <wking@drexel.edu>
2 #
3 # This file is part of pygrader.
4 #
5 # pygrader is free software: you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation, either version 3 of the License, or (at your option) any later
8 # version.
9 #
10 # pygrader is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License along with
15 # pygrader.  If not, see <http://www.gnu.org/licenses/>.
16
17 class Grade (object):
18     def __init__(self, student, assignment, points, comment=None,
19                  late=False, notified=False):
20         self.student = student
21         self.assignment = assignment
22         self.points = points
23         self.comment = comment
24         self.late = late
25         self.notified = notified
26
27     def __str__(self):
28         return '<{} {}:{}>'.format(
29             type(self).__name__, self.student.name, self.assignment.name)
30
31     def __lt__(self, other):
32         if self.student < other.student:
33             return True
34         elif other.student < self.student:
35             return False
36         return self.assignment < other.assignment