Beispiel #1
0
    def list(self, contest_id="26", ok=""):
        file_list = []
        for root, dirs, files in os.walk(self.get_runs_path(contest_id)):
            for file in files:
                path = os.path.join(root, file)
                basename = os.path.basename(file)
                runid = re.sub("\..*$", "", basename)
                try:
                    runid = str(int(runid))
                except e:
                    pass
                file_list.append({"runid": runid, "path": path})

        sources_ans = backend.ask_audit(contest_id, [f["runid"] for f in file_list])
        backend.process_audit_response(sources_ans, file_list)

        if ok:
            file_list = [f for f in file_list if f.has_key("status") and f["status"] == "OK"]

        template = self.env.get_template("list.html")
        return template.render(
            files=sorted(file_list, key=lambda x: int(x["runid"]), reverse=True), contest_id=contest_id
        )
Beispiel #2
0
 def add_audit(contest_id, src):
     sources = [s for s in src if s["contest_id"] == contest_id]
     sources_ans = backend.ask_audit(contest_id, [s["runid"] for s in sources])
     backend.process_audit_response(sources_ans, sources)