def check_submission( self, student ): stud_repo = repo.get_repo( student, self.pull ) if stud_repo == None: return ( self.EMPTY, None ) state = self.COMPLETE first = self.first_full_commit( stud_repo ) sub_dir = self.dir if first == None: #either a required file is missing, or the dir is mis-named dir_matches = [] first = repo.find_first_commit( stud_repo, '(?i)' + self.dir, matches = dir_matches, tabs = self.r_tabs ) if first == None: return ( self.MISSING, None ) else: state = self.MALFORMED sub_dir = dir_matches[0] first_date = repo.commit_datetime( first ) submissions = [] def add_subm( commit ): if len(submissions) == 0 or \ submissions[len(submissions)-1].commit != commit: submissions.append( Submission( self, commit, len(submissions) == 0, dir = sub_dir ) ) for dd in [self.due_date, self.drop_dead_date, None]: if dd == None or first_date < dd: add_subm( repo.find_last_commit( stud_repo, sub_dir, dd, tabs = self.r_tabs ) ) return (state, submissions)
def first_full_commit( self, repository ): latest_commit = None for r in self.required_files: cmt = repo.find_first_commit( repository, r, tabs = self.r_tabs ) if cmt == None: return None elif latest_commit == None or \ cmt.committed_date > latest_commit.committed_date: latest_commit = cmt return latest_commit