From 1573b4b19a8636b0518eb281e952e09e9b22ad3c Mon Sep 17 00:00:00 2001 From: jeshrz Date: Sun, 9 May 2021 20:05:11 +0800 Subject: [PATCH] bugfix: a series of bugs (#37) * fix: default value of eamilVerified is 1 * feat: show private contest tag * fix: set to correct problem description when editing contests * fix: correctly delete manager group --- public/excel/user.xlsx | Bin 9647 -> 9685 bytes src/utils/constants.js | 6 +++ src/views/contest/ContestListView.vue | 56 ++++++++++++++++---------- src/views/user/UserView.vue | 2 +- 4 files changed, 42 insertions(+), 22 deletions(-) diff --git a/public/excel/user.xlsx b/public/excel/user.xlsx index 4731712a1bcce82ffc40d6b63f3cb1159b7ed6cb..29aa15a7b0a95f3df3667a1c631dedbf5c93dfdf 100644 GIT binary patch delta 2864 zcmY+GbyO1!7sf|RNr#SxO#uVY5lRTs-5>}ENV5$EVdP-6^hPL1ODG@>l9O-)Mt8k* zBaNh!&-eY#dB5}BKkmKfK7Zcxoaa}rHKtWTyoR*W>%*eR0087Q0Du7i03h7&`@mnj z*}>s%_YhF`QWGn9i8N!Njms6;Qs(rUC^@8shNQ--)~7@g$}7t8VS(LaTvDfTjJWq0 z%ulo^t7-u<0cScEdwbt6p3M|~D!T<{|O9vL{*)Q&8_$mv*>txw^CPxt9cK|P_*0mlL*es zNRVTh5t3Yg!p@%>`6B8&isKHO%0z`JTv4dx6XnI{B~eHYq*4CX zp2XSEX;Y)lB7&*9pH1itkl7qaZFUWbMA>>oO0^9YnL(Npm7>GtNu6sz#BL;tiGNS2 z;+!kABQZc|ibYChwi><2@hsfGbe}DDAzM|DugqFhoP00Fxh*ThEt~5;q7PO#T)W}= zGgA_5R0|z5-Yi{7Phs&V*Q#{flYCjP`N+CMxJ{m4^3fFGT*(4tIrwGVlM#6cV2H4l z_9nBZZhtqP-ks_y$x=qiz5DCpS>MmeYR%yGGOZIQJSeoCG%%!GY*?W1bPKiBv-MK0 za;TPceTd8`N9pI9d z)eKfvCiOCf!4L3#M=#PD?-M#U89Y=YUhz8@m1M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G5fYC(o7zk8ckR>CUBCq98+WP>f}UfJ6O|c9%E(} z#H1vpL{l>e5`QvQkucy*A)!c&Cq=v$4OE31s>0MF#SYO-tcXli>^!JoM&_O)WG%w( z>adFhwr_(pV(nSv#tITuMO^HM7`8^~Gt1HAV1PHH5C?!5na6RBEJZxTj*&HREH}#_ zQxo1;; zJn=f^h(wlo^+HYoQydOHtAyhD=m5~?mks~b_55<`eVqPvG^+&NEAW-t+D?Yfg7(*y zum&%O-f;XcYaCd&GnxOW`Q1852TXoE;?+*@wzs|(+4Nciw>sg?228+|*Bbk^vHRxm zXQ}L-TyF65Hau)R+Hl{$cB{=LOe;(rGP(6aPOYR*e%^;Nqb8H9`COy~|L|o~kP}{O zvMD4JL3;=+ix#g={b3IbBx8kpI^xZKPHj1 zfy$m72u>8=LUPwtn=~ZRZvJ}HcB_^7;A8GN_q*p_k}dbDjy}PO~#(?z|xG0dcW5VQU=e=PVJFx@BT@oBR zh}*`0D(=J6me_Fd&P%{ELawj^&n5R9cfi<;M07+-F(S=}t$TnJ7-~?Uy~8x2_{ZzP zD)(nYuS}e(@&^-kI>w!{r5MD~y?51UY}+_MXPw~t8{;^**u5@=R0jS8NV8R0T zjV<25?d(^EC#CLuHFtg;F1@Wl-W*2Pxe{1Cee?kcG74eX5dEY)r?+>T6)I+AMq)~1 zy4a98BMX+2*KY8y{w~~5P{;BABT~vJVd?dRcmfm|KKl^GH?v_NumcG>0-1n;0{{Sk zlNuyW0iBa+Bsu{;lcXdj1;j~Xt8~%_!Mj-+K05Jvt02BZK z00000000000001XlPe`B8*psWL_z@o09^tA01*HH00000000000002VlWiqF0Ya0k MB_jqIBLDyZ0CinB7ytkO diff --git a/src/utils/constants.js b/src/utils/constants.js index 717de55..4f85fd7 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -210,3 +210,9 @@ export const GROUP_STATUS_TYPE = { JOINED: 2, REJECTED: 3 }; + +export const CONTEST_PROBLEM_STATUS = { + INIT: 0, + READY: 1, + FAILED: 2 +}; diff --git a/src/views/contest/ContestListView.vue b/src/views/contest/ContestListView.vue index 2e244a7..f8e7575 100644 --- a/src/views/contest/ContestListView.vue +++ b/src/views/contest/ContestListView.vue @@ -29,6 +29,7 @@ :color="CONTEST_OPENNESS.PROTECTED.lockColor" type="md-lock" size="19" /> + Private @@ -248,7 +248,7 @@ import MarkdownEditor from '_c/editor/MarkdownEditor'; import api from '_u/api'; import { split } from '_u/split'; -import { CONTEST_OPENNESS, CONTEST_MODE } from '_u/constants'; +import { CONTEST_OPENNESS, CONTEST_MODE, CONTEST_PROBLEM_STATUS } from '_u/constants'; function $contestProblemIdEncode(problemCode) { problemCode = parseInt(problemCode); @@ -416,10 +416,15 @@ export default { this.$refs.md.setMarkdown(this.contest.markdownDescription); this.contest.problems.forEach(o => { - this.$set(o, '$ready', 0); + this.$set(o, '$ready', CONTEST_PROBLEM_STATUS.INIT); this.$set(o, 'problemDescriptionList', []); this.getProblemDescriptionList(o); }); + + this.managerGroupSet = []; + if (this.contest.managerGroupDTO) { + this.managerGroupSet.push(this.contest.managerGroupDTO); + } this.isAddContest = fork; this.openModal(); }).catch(err => { @@ -452,7 +457,8 @@ export default { problemDescriptionId: '', problemDescriptionList: [], problemColor: '', - oldProblemCode: '' + oldProblemCode: '', + $ready: CONTEST_PROBLEM_STATUS.INIT }; const index = this.contest.problems.length; this.contest.problems.push(newProblem); @@ -467,7 +473,8 @@ export default { if (!row.problemCode || row.oldProblemCode === row.problemCode) return; row.oldProblemCode = row.problemCode; api.getProblem({ problemCode: row.problemCode }).then(ret => { - row.$ready = 1; + row.$ready = CONTEST_PROBLEM_STATUS.INIT; + row.problemDescriptionId = ''; row.problemWeight = 1; row.problemTitle = ret.problemTitle; this.getProblemDescriptionList(row).catch(_ => { @@ -477,7 +484,7 @@ export default { }); }).catch(err => { this.$Message.error(err.message); - row.$ready = 2; + row.$ready = CONTEST_PROBLEM_STATUS.FAILED; row.problemTitle = ''; row.problemDescriptionId = ''; row.problemDescriptionList = []; @@ -536,17 +543,26 @@ export default { return new Promise((resolve, reject) => { api.getProblemDescriptionList({ problemCode: row.problemCode }).then(ret => { row.problemDescriptionList = ret; - if (ret.length > 0) { - row.problemDescriptionId = ret[0].id; - row.$ready = 1; + resolve(ret); + if (row.problemDescriptionId === '') { + if (ret.length > 0) { + row.problemDescriptionId = ret[0].id; + row.$ready = CONTEST_PROBLEM_STATUS.READY; + } else { + row.problemDescriptionId = ''; + row.$ready = CONTEST_PROBLEM_STATUS.FAILED; + } } else { - row.problemDescriptionId = ''; - row.$ready = 2; + const problemDescriptionIds = ret.map(o => o.id); + if (problemDescriptionIds.includes(row.problemDescriptionId)) { + row.$ready = CONTEST_PROBLEM_STATUS.READY; + } else { + row.$ready = CONTEST_PROBLEM_STATUS.FAILED; + } } - resolve(ret); }).catch(err => { this.$Message.error(err.message); - row.$ready = 2; + row.$ready = CONTEST_PROBLEM_STATUS.FAILED; reject(err); }); }); @@ -593,9 +609,6 @@ export default { this.participatingGroupSet = []; } }, - setManagerGroupSet: function () { - this.participatingGroupSet = [this.contest.managerGroupDTO || undefined]; - }, setParticipatingGroupSet: function () { this.participatingGroupSet = this.contest.participatingGroupDTOList; }, @@ -620,7 +633,7 @@ export default { } for (let i = 0; i < this.contest.problems.length; ++i) { const o = this.contest.problems[i]; - if (o.$ready !== 1 || !o.problemDescriptionId || !o.problemTitle) { + if (o.$ready !== CONTEST_PROBLEM_STATUS.READY || !o.problemDescriptionId || !o.problemTitle) { this.$Message.error(`Problem ${$contestProblemIdEncode(i)} is not ready`); this.tabErrors.problem = true; return false; @@ -633,6 +646,7 @@ export default { computed: { CONTEST_OPENNESS: () => CONTEST_OPENNESS, CONTEST_MODE: () => CONTEST_MODE, + CONTEST_PROBLEM_STATUS: () => CONTEST_PROBLEM_STATUS, moment: () => moment, gmtLength: { get: function () { diff --git a/src/views/user/UserView.vue b/src/views/user/UserView.vue index 0dfed84..74075e6 100644 --- a/src/views/user/UserView.vue +++ b/src/views/user/UserView.vue @@ -374,7 +374,7 @@ export default { this.$Message.error('No data'); } else { this.excelData.forEach(o => { - o.emailVerified = parseInt(o.emailVerified) || 0; + o.emailVerified = parseInt(o.emailVerified) || 1; o.gender = parseInt(o.gender) || 2; }); api.addUsers(this.excelData).then(_ => {