Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
279 changes: 279 additions & 0 deletions oioioi/contests/fixtures/test_submission_python.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,279 @@
[
{
"pk": 1,
"model": "contests.submission",
"fields": {
"status": "OK",
"problem_instance": 1,
"kind": "NORMAL",
"comment": "",
"score": "int:0000000000000000034",
"user": 1001,
"date": "2012-06-03T22:07:07.516Z"
}
},
{
"pk": 1,
"model": "contests.submissionreport",
"fields": {
"status": "ACTIVE",
"kind": "INITIAL",
"submission": 1,
"creation_date": "2012-08-03T22:07:29.547Z"
}
},
{
"pk": 2,
"model": "contests.submissionreport",
"fields": {
"status": "ACTIVE",
"kind": "NORMAL",
"submission": 1,
"creation_date": "2012-08-03T22:07:39.662Z"
}
},
{
"pk": 1,
"model": "contests.scorereport",
"fields": {
"status": "OK",
"comment": null,
"score": null,
"submission_report": 1,
"max_score": "int:0000000000000000100"
}
},
{
"pk": 2,
"model": "contests.scorereport",
"fields": {
"status": "RE",
"comment": null,
"score": "int:0000000000000000034",
"submission_report": 2,
"max_score": "int:0000000000000000100"
}
},
{
"pk": 1,
"model": "contests.userresultforproblem",
"fields": {
"status": "OK",
"problem_instance": 1,
"score": "int:0000000000000000034",
"user": 1001,
"submission_report": 2
}
},
{
"pk": 1,
"model": "contests.userresultforround",
"fields": {
"score": "int:0000000000000000034",
"user": 1001,
"round": 1
}
},
{
"pk": 1,
"model": "contests.userresultforcontest",
"fields": {
"score": "int:0000000000000000034",
"user": 1001,
"contest": "c"
}
},
{
"pk": 1,
"model": "programs.programsubmission",
"fields": {
"source_file": "data:submissions/c/1.py:data:submissions/c/2.py:YSwgYiA9IGlucHV0KCkuc3BsaXQoKQoKcHJpbnQoaW50KGEpICsgaW50KGIpKQ==",
"source_length": 46
}
},
{
"pk": 1,
"model": "programs.compilationreport",
"fields": {
"status": "OK",
"compiler_output": "",
"submission_report": 1
}
},
{
"pk": 2,
"model": "programs.compilationreport",
"fields": {
"status": "OK",
"compiler_output": "",
"submission_report": 2
}
},
{
"pk": 1,
"model": "programs.testreport",
"fields": {
"status": "OK",
"comment": "",
"test_time_limit": 10000,
"submission_report": 1,
"time_used": 1,
"test_group": "0",
"score": "int:0000000000000000000",
"test_name": "0",
"test": 1
}
},
{
"pk": 2,
"model": "programs.testreport",
"fields": {
"status": "OK",
"comment": "",
"test_time_limit": 10000,
"submission_report": 1,
"time_used": 1,
"test_group": "1ocen",
"score": "int:0000000000000000000",
"test_name": "1ocen",
"test": 4
}
},
{
"pk": 3,
"model": "programs.testreport",
"fields": {
"status": "OK",
"comment": "",
"test_time_limit": 10000,
"submission_report": 2,
"time_used": 1,
"test_group": "1",
"score": "int:0000000000000000005",
"test_name": "1a",
"test": 2
}
},
{
"pk": 4,
"model": "programs.testreport",
"fields": {
"status": "OK",
"comment": "",
"test_time_limit": 10000,
"submission_report": 2,
"time_used": 1,
"test_group": "3",
"score": "int:0000000000000000034",
"test_name": "3",
"test": 6
}
},
{
"pk": 5,
"model": "programs.testreport",
"fields": {
"status": "WA",
"comment": "",
"test_time_limit": 10000,
"submission_report": 2,
"time_used": 0,
"test_group": "2",
"score": "int:0000000000000000000",
"test_name": "2",
"test": 5
}
},
{
"pk": 6,
"model": "programs.testreport",
"fields": {
"status": "RE",
"comment": "program exited with code 1",
"test_time_limit": 100,
"submission_report": 2,
"time_used": 0,
"test_group": "1",
"score": "int:0000000000000000000",
"test_name": "1b",
"test": 3
}
},
{
"pk": 1,
"model": "programs.groupreport",
"fields": {
"status": "OK",
"group": "0",
"score": "int:0000000000000000000",
"max_score": "int:0000000000000000000",
"submission_report": 1
}
},
{
"pk": 2,
"model": "programs.groupreport",
"fields": {
"status": "OK",
"group": "1ocen",
"score": "int:0000000000000000000",
"max_score": "int:0000000000000000000",
"submission_report": 1
}
},
{
"pk": 3,
"model": "programs.groupreport",
"fields": {
"status": "RE",
"group": "1",
"score": "int:0000000000000000000",
"max_score": "int:0000000000000000033",
"submission_report": 2
}
},
{
"pk": 4,
"model": "programs.groupreport",
"fields": {
"status": "OK",
"group": "0",
"score": "int:0000000000000000000",
"max_score": "int:0000000000000000000",
"submission_report": 2
}
},
{
"pk": 5,
"model": "programs.groupreport",
"fields": {
"status": "OK",
"group": "3",
"score": "int:0000000000000000034",
"max_score": "int:0000000000000000034",
"submission_report": 2
}
},
{
"pk": 6,
"model": "programs.groupreport",
"fields": {
"status": "OK",
"group": "1ocen",
"score": "int:0000000000000000000",
"max_score": "int:0000000000000000000",
"submission_report": 2
}
},
{
"pk": 7,
"model": "programs.groupreport",
"fields": {
"status": "WA",
"group": "2",
"score": "int:0000000000000000000",
"max_score": "int:0000000000000000033",
"submission_report": 2
}
}
]
1 change: 1 addition & 0 deletions oioioi/programs/static/code_formatter/clang-format.js

Large diffs are not rendered by default.

Binary file not shown.
44 changes: 44 additions & 0 deletions oioioi/programs/static/code_formatter/formatter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import init, { format, version } from "./clang-format.js";

// clang-format
async function cpp_code_formatter(source) {
await init();
console.log(version());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

const formatted = format(
source,
"main.cc",
JSON.stringify({
BasedOnStyle: "Chromium",
IndentWidth: 4,
ColumnLimit: 80,
})
);
return formatted;
}

async function format_cpp_code() {
const source = document.getElementById("raw_source").textContent;
const formatted_source = await cpp_code_formatter(source);
var visible_source = document.getElementById("visible_source");
const coloured_source = Prism.highlight(formatted_source, Prism.languages.cpp, "cpp");
visible_source.innerHTML = coloured_source;
window.globalThis.Prism = Prism;
}

window.globalThis.format_cpp_code = format_cpp_code;

//
// Utility
//

/**
*
* @param {string} [text]
* @throws {Error}
* @returns {never}
*/
function errorExpression(text) {
text = text ?? "error; check the console";
alert(text);
throw new Error(text);
}
3 changes: 3 additions & 0 deletions oioioi/programs/static/common/prism.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading