mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: 在线IDE中显示历史提交
This commit is contained in:
1 parent
5cae54ed0a
commit
5153a7a871
8 files changed
+6
-70
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.28.42",
|
"version": "2.28.43",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -321,15 +321,7 @@ export class ContestDetailProblemSubmitHandler extends ContestProblemHandler {
|
|||||||
|
|
||||||
@param('tid', Types.ObjectID)
|
@param('tid', Types.ObjectID)
|
||||||
@param('pid', Types.Name)
|
@param('pid', Types.Name)
|
||||||
async get(domainId: string, tid: ObjectID, _pid: string) {
|
async get(domainId: string, tid: ObjectID, pid: string) {
|
||||||
const pid = this.tdoc.pids[parseInt(_pid, 36) - 10];
|
|
||||||
this.response.body.rdocs = [];
|
|
||||||
if (contest.canShowRecord.call(this, this.tdoc)) {
|
|
||||||
this.response.body.rdocs = await record.getUserInProblemMulti(
|
|
||||||
domainId, this.user._id,
|
|
||||||
pid, { type: document.TYPE_CONTEST, tid },
|
|
||||||
).sort({ _id: -1 }).limit(10).toArray();
|
|
||||||
}
|
|
||||||
this.response.body.path = [
|
this.response.body.path = [
|
||||||
['Hydro', 'homepage'],
|
['Hydro', 'homepage'],
|
||||||
['contest_main', 'contest_main'],
|
['contest_main', 'contest_main'],
|
||||||
|
|||||||
@@ -197,12 +197,7 @@ class HomeworkDetailProblemSubmitHandler extends HomeworkDetailProblemHandler {
|
|||||||
|
|
||||||
@param('tid', Types.ObjectID)
|
@param('tid', Types.ObjectID)
|
||||||
@param('pid', Types.String)
|
@param('pid', Types.String)
|
||||||
async get(domainId: string, tid: ObjectID, _pid: string) {
|
async get(domainId: string, tid: ObjectID, pid: string) {
|
||||||
const pid = this.tdoc.pids[parseInt(_pid, 36) - 10];
|
|
||||||
this.response.body.rdocs = contest.canShowRecord.call(this, this.tdoc)
|
|
||||||
? await record.getUserInProblemMulti(domainId, this.user._id, pid, { type: document.TYPE_HOMEWORK, tid })
|
|
||||||
.sort('_id', -1).limit(10).toArray()
|
|
||||||
: [];
|
|
||||||
this.response.body.path = [
|
this.response.body.path = [
|
||||||
['Hydro', 'homepage'],
|
['Hydro', 'homepage'],
|
||||||
['homework_main', 'homework_main'],
|
['homework_main', 'homework_main'],
|
||||||
|
|||||||
@@ -248,11 +248,6 @@ export class ProblemSubmitHandler extends ProblemDetailHandler {
|
|||||||
@param('pid', Types.Name, null, parsePid)
|
@param('pid', Types.Name, null, parsePid)
|
||||||
async get(domainId: string, pid: string | number) {
|
async get(domainId: string, pid: string | number) {
|
||||||
this.response.template = 'problem_submit.html';
|
this.response.template = 'problem_submit.html';
|
||||||
const rdocs = await record
|
|
||||||
.getUserInProblemMulti(domainId, this.user._id, pid)
|
|
||||||
.sort({ _id: -1 })
|
|
||||||
.limit(10)
|
|
||||||
.toArray();
|
|
||||||
this.response.body = {
|
this.response.body = {
|
||||||
path: [
|
path: [
|
||||||
['Hydro', 'homepage'],
|
['Hydro', 'homepage'],
|
||||||
@@ -262,7 +257,6 @@ export class ProblemSubmitHandler extends ProblemDetailHandler {
|
|||||||
],
|
],
|
||||||
pdoc: this.pdoc,
|
pdoc: this.pdoc,
|
||||||
udoc: this.udoc,
|
udoc: this.udoc,
|
||||||
rdocs,
|
|
||||||
title: this.pdoc.title,
|
title: this.pdoc.title,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.11.29",
|
"version": "4.11.30",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
@@ -12,13 +12,13 @@
|
|||||||
{% if tdoc %}
|
{% if tdoc %}
|
||||||
{{ set(UiContext, 'canViewRecord', model.contest.canShowRecord.call(handler, tdoc)) }}
|
{{ set(UiContext, 'canViewRecord', model.contest.canShowRecord.call(handler, tdoc)) }}
|
||||||
{{ set(UiContext, 'postSubmitUrl', url('contest_detail_problem_submit' if tdoc.docType == model.document.TYPE_CONTEST else 'homework_detail_problem_submit', pid=pdoc.pid, tid=tdoc.docId)) }}
|
{{ set(UiContext, 'postSubmitUrl', url('contest_detail_problem_submit' if tdoc.docType == model.document.TYPE_CONTEST else 'homework_detail_problem_submit', pid=pdoc.pid, tid=tdoc.docId)) }}
|
||||||
{{ set(UiContext, 'getSubmissionsUrl', url('contest_detail_problem_submit' if tdoc.docType == model.document.TYPE_CONTEST else 'homework_detail_problem_submit', pid=pdoc.pid, tid=tdoc.docId)) }}
|
{{ set(UiContext, 'getSubmissionsUrl', url('record_main', query={uidOrName:handler.user._id, pid:pdoc.pid, tid:tdoc.docId})) }}
|
||||||
{{ set(UiContext, 'getRecordDetailUrl', url('record_detail', rid='{rid}', query={tid:tdoc.docId})) }}
|
{{ set(UiContext, 'getRecordDetailUrl', url('record_detail', rid='{rid}', query={tid:tdoc.docId})) }}
|
||||||
{{ set(UiContext, 'pretestConnUrl', "/record-conn?pretest=1&uid=" + handler.user._id + "&pid=" + pdoc.domainId + ":" + pdoc.docId + "&domainId=" + handler.domainId + "&tid=" + tdoc.docId) }}
|
{{ set(UiContext, 'pretestConnUrl', "/record-conn?pretest=1&uid=" + handler.user._id + "&pid=" + pdoc.domainId + ":" + pdoc.docId + "&domainId=" + handler.domainId + "&tid=" + tdoc.docId) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ set(UiContext, 'canViewRecord', true) }}
|
{{ set(UiContext, 'canViewRecord', true) }}
|
||||||
{{ set(UiContext, 'postSubmitUrl', url('problem_submit', pid=pdoc.docId)) }}
|
{{ set(UiContext, 'postSubmitUrl', url('problem_submit', pid=pdoc.docId)) }}
|
||||||
{{ set(UiContext, 'getSubmissionsUrl', url('problem_submit', pid=pdoc.docId)) }}
|
{{ set(UiContext, 'getSubmissionsUrl', url('record_main', query={uidOrName:handler.user._id, pid:pdoc.docId})) }}
|
||||||
{{ set(UiContext, 'getRecordDetailUrl', url('record_detail', rid='{rid}')) }}
|
{{ set(UiContext, 'getRecordDetailUrl', url('record_detail', rid='{rid}')) }}
|
||||||
{{ set(UiContext, 'pretestConnUrl', "/record-conn?pretest=1&uid=" + handler.user._id + "&pid=" + pdoc.docId + "&domainId=" + handler.domainId) }}
|
{{ set(UiContext, 'pretestConnUrl', "/record-conn?pretest=1&uid=" + handler.user._id + "&pid=" + pdoc.docId + "&domainId=" + handler.domainId) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -3,40 +3,6 @@
|
|||||||
{{ set(UiContext, 'pdocConfig', pdoc.config) }}
|
{{ set(UiContext, 'pdocConfig', pdoc.config) }}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="medium-9 columns">
|
<div class="medium-9 columns">
|
||||||
{% if not tdoc or rdocs.length %}
|
|
||||||
<div class="section">
|
|
||||||
<div class="section__header">
|
|
||||||
<h1 class="section__title">{{ _('Recent 10 Records') }}</h1>
|
|
||||||
</div>
|
|
||||||
<div class="section__body no-padding">
|
|
||||||
{% if not rdocs.length %}
|
|
||||||
{{ nothing.render('You have not submitted any solutions for this problem') }}
|
|
||||||
{% else %}
|
|
||||||
<table class="data-table">
|
|
||||||
<colgroup>
|
|
||||||
<col class="col--status">
|
|
||||||
<col class="col--memory">
|
|
||||||
<col class="col--time">
|
|
||||||
<col class="col--submit-at">
|
|
||||||
</colgroup>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th class="col--status record-status--border">{{ _('Status') }}</th>
|
|
||||||
<th class="col--memory">{{ _('Peak Memory') }}</th>
|
|
||||||
<th class="col--time">{{ _('Total Time') }}</th>
|
|
||||||
<th class="col--submit-at">{{ _('Submit At') }}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{%- for rdoc in rdocs -%}
|
|
||||||
{% include 'problem_submit_tr.html' %}
|
|
||||||
{%- endfor -%}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
<div class="section">
|
<div class="section">
|
||||||
<div class="section__header">
|
<div class="section__header">
|
||||||
<h1 class="section__title">{{ _('Submit to Judge') }}</h1>
|
<h1 class="section__title">{{ _('Submit to Judge') }}</h1>
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
{% import "components/record.html" as record with context %}
|
|
||||||
<tr data-rid="{{ rdoc['_id'] }}">
|
|
||||||
{{ record.render_status_td(rdoc) }}
|
|
||||||
<td class="col--memory">
|
|
||||||
{{ (rdoc.memory / 1000)|round(0, 'ceil')|int }} MB
|
|
||||||
</td>
|
|
||||||
<td class="col--time">
|
|
||||||
{{ rdoc.time|round|int }}ms
|
|
||||||
</td>
|
|
||||||
<td class="col--submit-at">{{ datetimeSpan(rdoc._id)|safe }}</td>
|
|
||||||
</tr>
|
|
||||||
Reference in new issue
Block a user