def is_half_complete(self): """ Did the user reach the required level for half credit? Ideally this would be more flexible than just 0, 0.5, or 1 credit. On the other hand, the xml attributes for specifying more specific cut-offs and partial grades can get more confusing. """ from foldit.models import PuzzleComplete complete = PuzzleComplete.is_level_complete( self.system.anonymous_student_id, self.required_level_half_credit, self.required_sublevel_half_credit, self.due_time) return complete
def is_complete(self): """ Did the user get to the required level before the due date? """ # We normally don't want django dependencies in xmodule. foldit is # special. Import this late to avoid errors with things not yet being # initialized. from foldit.models import PuzzleComplete complete = PuzzleComplete.is_level_complete( self.system.anonymous_student_id, self.required_level, self.required_sublevel, self.due_time) return complete
def completed_puzzles(self): """ Return a list of puzzles that this user has completed, as an array of dicts: [ {'set': int, 'subset': int, 'created': datetime} ] The list is sorted by set, then subset """ from foldit.models import PuzzleComplete return sorted( PuzzleComplete.completed_puzzles(self.system.anonymous_student_id), key=lambda d: (d['set'], d['subset']))