Exemplo n.º 1
0
    def update_score_in_contest(self,
                                problem_alias,
                                contest_alias,
                                verdict='AC',
                                score=1):
        '''Set verdict and score of latest run'''

        run_id = database_utils.mysql(('''
            SELECT
                MAX(`r`.`run_id`)
            FROM
                `Runs` AS `r`
            INNER JOIN
                `Problems` AS `p` ON
                `p`.`problem_id` = `r`.`problem_id`
            INNER JOIN
                `Problemsets` AS `ps` ON
                `ps`.`problemset_id` = `r`.`problemset_id`
            INNER JOIN
                `Contests` AS `c` ON `c`.`acl_id` = `ps`.`acl_id`
            WHERE
                `p`.`alias` = '%s'
                AND `c`.`alias` = '%s';
            ''') % (problem_alias, contest_alias),
                                      dbname='omegaup',
                                      auth=self.mysql_auth())
        self.update_run_score(int(run_id.strip()), verdict, score)
Exemplo n.º 2
0
    def update_run_score(self, run_id, verdict, score):
        '''Set verdict and score of specified run'''

        database_utils.mysql(('''
            UPDATE
                `Runs`
            SET
                `score` = %s,
                `contest_score` = %s,
                `verdict` = '%s',
                `status` = 'ready'
            WHERE
                `run_id` = %s;
            ''') % (str(score), str(score * 100), verdict, str(run_id)),
                             dbname='omegaup',
                             auth=self.mysql_auth())