Skip to content

Commit 8ed7405

Browse files
authored
core: fix contest ghost export (#996)
1 parent db68d25 commit 8ed7405

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

packages/hydrooj/src/handler/contest.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ export async function apply(ctx: Context) {
795795
const escape = (i: string) => i.replace(/[",]/g, '');
796796
const unknownSchool = this.translate('Unknown School');
797797
const statusMap = {
798-
[STATUS.STATUS_ACCEPTED]: 'AC',
798+
[STATUS.STATUS_ACCEPTED]: 'OK',
799799
[STATUS.STATUS_WRONG_ANSWER]: 'WA',
800800
[STATUS.STATUS_COMPILE_ERROR]: 'CE',
801801
[STATUS.STATUS_TIME_LIMIT_EXCEEDED]: 'TL',
@@ -820,8 +820,10 @@ export async function apply(ctx: Context) {
820820
].concat(
821821
tdoc.pids.map((i, idx) => `@p ${pid(idx)},${escape(pdict[i]?.title || 'Unknown Problem')},20,0`),
822822
teams.map((i, idx) => {
823-
const teamName = `${i.rank ? '*' : ''}${escape(udict[i.uid].school || unknownSchool)}-${escape(udict[i.uid].uname)}`;
824-
return `@t ${idx + 1},0,1,${teamName}`;
823+
const showName = this.user.hasPerm(PERM.PERM_VIEW_DISPLAYNAME) && udict[i.uid].displayName
824+
? udict[i.uid].displayName : udict[i.uid].uname;
825+
const teamName = `${i.rank ? '*' : ''}${escape(udict[i.uid].school || unknownSchool)}-${escape(showName)}`;
826+
return `@t ${idx + 1},0,1,"${teamName}"`;
825827
}),
826828
submissions,
827829
);

0 commit comments

Comments
 (0)