diff --git a/libs/submissions_process.js b/libs/submissions_process.js index 44d4503..faa5714 100644 --- a/libs/submissions_process.js +++ b/libs/submissions_process.js @@ -18,7 +18,8 @@ const getRoughResult = (x, displayConfig) => { return { result: x.status, time: displayConfig.showUsage ? x.total_time : null, - memory: displayConfig.showUsage ? x.max_memory : null, + memory: displayConfig.showUsage ? syzoj.utils.formatSize((x.max_memory * 1024) || 0, 2) : null, + precise_memory: displayConfig.showUsage ? x.max_memory : null, score: displayConfig.showScore ? x.score : null }; } @@ -72,4 +73,4 @@ const processOverallResult = (source, config) => { }; } -module.exports = { getRoughResult, getSubmissionInfo, processOverallResult }; \ No newline at end of file +module.exports = { getRoughResult, getSubmissionInfo, processOverallResult }; diff --git a/utility.js b/utility.js index 6304b22..6b70d11 100644 --- a/utility.js +++ b/utility.js @@ -121,8 +121,8 @@ module.exports = { } return sgn + util.format('%s:%s:%s', toStringWithPad(x / 3600), toStringWithPad(x / 60 % 60), toStringWithPad(x % 60)); }, - formatSize(x) { - let res = filesize(x, { fixed: 1 }).calculate(); + formatSize(x, precision) { + let res = filesize(x, { fixed: precision || 1 }).calculate(); if (res.result === parseInt(res.result)) res.fixed = res.result.toString(); if (res.suffix.startsWith('Byte')) res.suffix = 'B'; else res.suffix = res.suffix.replace('iB', ''); diff --git a/views/submissions_item.ejs b/views/submissions_item.ejs index 14637eb..bff0679 100644 --- a/views/submissions_item.ejs +++ b/views/submissions_item.ejs @@ -69,7 +69,13 @@ Vue.component('submission-item', {