Exemple #1
0
    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)
Exemple #2
0
 def last_commit( self, repository, before = None ):
     return repo.find_last_commit( repository, self.dir, before, 
                                   tabs = self.r_tabs  )