@xcpcio/core 0.29.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -244,12 +244,16 @@ class CodeforcesGymGhostDATConverter {
244
244
  const teamId = submission.teamId;
245
245
  const problemId = submission.problemId;
246
246
  const problem = rank.contest.problemsMap.get(problemId);
247
+ const teamIndex2 = teamIdMap.get(teamId);
247
248
  if (!problem) {
248
249
  return;
249
250
  }
251
+ if (!teamIndex2) {
252
+ return;
253
+ }
250
254
  const status = this.submissionStatusToCodeforcesGymDatStatus(submission.status);
251
255
  submissionsIdMap.get(teamId).set(problemId, submissionsIdMap.get(teamId).get(problemId) + 1);
252
- res += `@s ${teamIdMap.get(teamId)},${problem.label},${submissionsIdMap.get(teamId)?.get(problemId)},${submission.timestampToSecond},${status}
256
+ res += `@s ${teamIndex2},${problem.label},${submissionsIdMap.get(teamId)?.get(problemId)},${submission.timestampToSecond},${status}
253
257
  `;
254
258
  });
255
259
  return res;
@@ -1258,6 +1262,22 @@ class Rank {
1258
1262
  this.rankStatistics = new RankStatistics();
1259
1263
  this.options = new RankOptions();
1260
1264
  this.balloons = [];
1265
+ {
1266
+ const se = /* @__PURE__ */ new Set();
1267
+ this.submissions.forEach((s) => {
1268
+ if (s.language) {
1269
+ se.add(s.language);
1270
+ }
1271
+ });
1272
+ this.languages = [...se].sort();
1273
+ }
1274
+ {
1275
+ const se = /* @__PURE__ */ new Set();
1276
+ this.submissions.forEach((s) => {
1277
+ se.add(s.status);
1278
+ });
1279
+ this.statuses = [...se].sort();
1280
+ }
1261
1281
  }
1262
1282
  cleanRank() {
1263
1283
  (() => {
package/dist/index.d.ts CHANGED
@@ -247,6 +247,8 @@ declare class Rank {
247
247
  rankStatistics: RankStatistics;
248
248
  options: RankOptions;
249
249
  balloons: Balloons;
250
+ languages: Array<string>;
251
+ statuses: Array<SubmissionStatus>;
250
252
  constructor(contest: Contest, teams: Teams, submissions: Submissions);
251
253
  cleanRank(): void;
252
254
  buildRank(): this;
package/dist/index.mjs CHANGED
@@ -214,12 +214,16 @@ class CodeforcesGymGhostDATConverter {
214
214
  const teamId = submission.teamId;
215
215
  const problemId = submission.problemId;
216
216
  const problem = rank.contest.problemsMap.get(problemId);
217
+ const teamIndex2 = teamIdMap.get(teamId);
217
218
  if (!problem) {
218
219
  return;
219
220
  }
221
+ if (!teamIndex2) {
222
+ return;
223
+ }
220
224
  const status = this.submissionStatusToCodeforcesGymDatStatus(submission.status);
221
225
  submissionsIdMap.get(teamId).set(problemId, submissionsIdMap.get(teamId).get(problemId) + 1);
222
- res += `@s ${teamIdMap.get(teamId)},${problem.label},${submissionsIdMap.get(teamId)?.get(problemId)},${submission.timestampToSecond},${status}
226
+ res += `@s ${teamIndex2},${problem.label},${submissionsIdMap.get(teamId)?.get(problemId)},${submission.timestampToSecond},${status}
223
227
  `;
224
228
  });
225
229
  return res;
@@ -1228,6 +1232,22 @@ class Rank {
1228
1232
  this.rankStatistics = new RankStatistics();
1229
1233
  this.options = new RankOptions();
1230
1234
  this.balloons = [];
1235
+ {
1236
+ const se = /* @__PURE__ */ new Set();
1237
+ this.submissions.forEach((s) => {
1238
+ if (s.language) {
1239
+ se.add(s.language);
1240
+ }
1241
+ });
1242
+ this.languages = [...se].sort();
1243
+ }
1244
+ {
1245
+ const se = /* @__PURE__ */ new Set();
1246
+ this.submissions.forEach((s) => {
1247
+ se.add(s.status);
1248
+ });
1249
+ this.statuses = [...se].sort();
1250
+ }
1231
1251
  }
1232
1252
  cleanRank() {
1233
1253
  (() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xcpcio/core",
3
- "version": "0.29.0",
3
+ "version": "0.31.0",
4
4
  "description": "XCPCIO Core",
5
5
  "author": "Dup4 <lyuzhi.pan@gmail.com>",
6
6
  "license": "MIT",
@@ -44,7 +44,7 @@
44
44
  "lodash": "^4.17.21",
45
45
  "string-width": "^6.1.0",
46
46
  "xlsx-js-style": "^1.2.0",
47
- "@xcpcio/types": "0.29.0"
47
+ "@xcpcio/types": "0.31.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@babel/types": "^7.22.4",
package/src/export/cf.ts CHANGED
@@ -64,15 +64,20 @@ export class CodeforcesGymGhostDATConverter {
64
64
  const teamId = submission.teamId;
65
65
  const problemId = submission.problemId;
66
66
  const problem = rank.contest.problemsMap.get(problemId);
67
+ const teamIndex = teamIdMap.get(teamId);
67
68
 
68
69
  if (!problem) {
69
70
  return;
70
71
  }
71
72
 
73
+ if (!teamIndex) {
74
+ return;
75
+ }
76
+
72
77
  const status = this.submissionStatusToCodeforcesGymDatStatus(submission.status);
73
78
  submissionsIdMap.get(teamId)!.set(problemId, submissionsIdMap.get(teamId)!.get(problemId)! + 1);
74
79
 
75
- res += `@s ${teamIdMap.get(teamId)},${problem.label},${submissionsIdMap.get(teamId)?.get(problemId)},${submission.timestampToSecond},${status}\n`;
80
+ res += `@s ${teamIndex},${problem.label},${submissionsIdMap.get(teamId)?.get(problemId)},${submission.timestampToSecond},${status}\n`;
76
81
  });
77
82
 
78
83
  return res;
package/src/rank.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import _ from "lodash";
2
2
 
3
+ import type { SubmissionStatus } from "@xcpcio/types";
4
+
3
5
  import type { Contest } from "./contest";
4
6
  import type { Teams } from "./team";
5
7
  import { Team } from "./team";
@@ -129,6 +131,9 @@ export class Rank {
129
131
 
130
132
  balloons: Balloons;
131
133
 
134
+ languages: Array<string>;
135
+ statuses: Array<SubmissionStatus>;
136
+
132
137
  constructor(contest: Contest, teams: Teams, submissions: Submissions) {
133
138
  this.contest = contest;
134
139
 
@@ -162,6 +167,28 @@ export class Rank {
162
167
  this.options = new RankOptions();
163
168
 
164
169
  this.balloons = [];
170
+
171
+ {
172
+ const se = new Set<string>();
173
+
174
+ this.submissions.forEach((s) => {
175
+ if (s.language) {
176
+ se.add(s.language);
177
+ }
178
+ });
179
+
180
+ this.languages = [...se].sort();
181
+ }
182
+
183
+ {
184
+ const se = new Set<SubmissionStatus>();
185
+
186
+ this.submissions.forEach((s) => {
187
+ se.add(s.status);
188
+ });
189
+
190
+ this.statuses = [...se].sort();
191
+ }
165
192
  }
166
193
 
167
194
  cleanRank() {