fix: undefined xcpcio scoreboard team_id (#1082)

This commit is contained in:
Taoning Ge authored and GitHub committed 2025-11-12 03:09:03 +00:00
1 parent 1b633f1184
commit 15d5cefe85
2 files changed
+4 -4

No files matched your search

+3 -3
View File
@@ -25,12 +25,12 @@ const status = {
[STATUS.STATUS_CANCELED]: 'CANCELED',
};
function submissionBase(tdoc: Tdoc, rdoc: RecordDoc) {
function submissionBase(tdoc: Tdoc, rdoc: RecordDoc, uid?: number) {
// NOTE: rdoc can be either record, or a tsdoc detail entry
const submit = new ObjectId(rdoc._id || (rdoc as any).rid).getTimestamp().getTime();
return {
problem_id: tdoc.pids.indexOf(rdoc.pid),
team_id: `${rdoc.uid}`,
team_id: `${uid || rdoc.uid}`,
timestamp: Math.floor(submit - tdoc.beginAt.getTime()),
language: rdoc.lang || '',
submission_id: rdoc._id,
@@ -60,7 +60,7 @@ async function loadContestState(tdoc: Tdoc, realtime: boolean) {
const submit = new ObjectId(j.rid as string).getTimestamp().getTime();
const curStatus = status[j.status] || 'SYSTEM_ERROR';
return {
...submissionBase(tdoc, j),
...submissionBase(tdoc, j, i.uid),
status: (ContestModel.isLocked(tdoc) && submit > tdoc.lockAt.getTime() && !realtime)
? 'PENDING'
: curStatus,
@@ -8,7 +8,7 @@
<div>
<ol class="menu">
{% if mode == 'contest' or mode == 'correction' %}
{% if page_name == 'contest_detail_problem' and handler.ctx.setting.get('ui-default.enableScratchpad') %} %}
{% if page_name == 'contest_detail_problem' and handler.ctx.setting.get('ui-default.enableScratchpad') %}
<li class="menu__item scratchpad--hide nojs--hide"><a class="menu__link highlight" name="problem-sidebar__open-scratchpad" href="javascript:;" data-global-hotkey="alt+e">
<span class="icon icon-enlarge"></span> {{ _('Open Scratchpad') }} (Alt+E)
</a></li>