@xcpcio/core 0.15.0 → 0.17.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
@@ -141,6 +141,7 @@ function isPending(status) {
141
141
  const pendingArray = [
142
142
  types.SubmissionStatus.PENDING,
143
143
  types.SubmissionStatus.WAITING,
144
+ types.SubmissionStatus.COMPILING,
144
145
  types.SubmissionStatus.JUDGING,
145
146
  types.SubmissionStatus.FROZEN
146
147
  ];
@@ -407,7 +408,7 @@ class GeneralExcelConverter {
407
408
  head.push(`${rank.contest.organization} Rank`);
408
409
  head.push(rank.contest.organization);
409
410
  }
410
- head.push("Name", "Solved", "Penalty", ...rank.contest.problems.map((p) => p.label), "Dict");
411
+ head.push("Name", "Solved", "Penalty", ...rank.contest.problems.map((p) => p.label), "Dirt");
411
412
  if (enableAwards) {
412
413
  head.push("Medal");
413
414
  }
@@ -439,7 +440,7 @@ class GeneralExcelConverter {
439
440
  arr.push(`? ${p.failedCount} + ${p.pendingCount}`);
440
441
  }
441
442
  }
442
- arr.push(`${team.dict}%`);
443
+ arr.push(`${team.dirt}%`);
443
444
  if (enableAwards) {
444
445
  const medals = team.awards.filter((a) => isValidMedalType(a)).map((a) => a.toString());
445
446
  arr.push(medals.join(", "));
@@ -450,7 +451,7 @@ class GeneralExcelConverter {
450
451
  }
451
452
  }
452
453
 
453
- function calcDict(attemptedNum, solvedNum) {
454
+ function calcDirt(attemptedNum, solvedNum) {
454
455
  if (solvedNum === 0) {
455
456
  return 0;
456
457
  }
@@ -478,11 +479,11 @@ class ProblemStatistics {
478
479
  this.firstSolveSubmissions = [];
479
480
  this.lastSolveSubmissions = [];
480
481
  }
481
- get dict() {
482
+ get dirt() {
482
483
  if (this.acceptedNum === 0) {
483
484
  return 0;
484
485
  }
485
- return calcDict(this.attemptedNum, this.acceptedNum);
486
+ return calcDirt(this.attemptedNum, this.acceptedNum);
486
487
  }
487
488
  }
488
489
  class Problem {
@@ -893,10 +894,10 @@ class Team {
893
894
  get penaltyToMinute() {
894
895
  return Math.floor(this.penalty / 60);
895
896
  }
896
- get dict() {
897
+ get dirt() {
897
898
  const attemptedNum = this.attemptedProblemNum;
898
899
  const solvedNum = this.solvedProblemNum;
899
- return calcDict(attemptedNum, solvedNum);
900
+ return calcDirt(attemptedNum, solvedNum);
900
901
  }
901
902
  get membersToString() {
902
903
  if (typeof this.members === "string") {
@@ -994,6 +995,9 @@ function createTeam(teamJSON) {
994
995
  }
995
996
  t.group = [...new Set(t.group)];
996
997
  t.group.sort();
998
+ if (teamJSON.location) {
999
+ t.location = teamJSON.location;
1000
+ }
997
1001
  return t;
998
1002
  }
999
1003
  function createTeams(teamsJSON) {
@@ -1446,7 +1450,7 @@ exports.Resolver = Resolver;
1446
1450
  exports.Submission = Submission;
1447
1451
  exports.Team = Team;
1448
1452
  exports.TeamProblemStatistics = TeamProblemStatistics;
1449
- exports.calcDict = calcDict;
1453
+ exports.calcDirt = calcDirt;
1450
1454
  exports.createContest = createContest;
1451
1455
  exports.createContestIndex = createContestIndex;
1452
1456
  exports.createContestIndexList = createContestIndexList;
package/dist/index.d.ts CHANGED
@@ -33,7 +33,7 @@ declare class ProblemStatistics {
33
33
  lastSolveSubmissions: Submissions;
34
34
  constructor();
35
35
  reset(): void;
36
- get dict(): number;
36
+ get dirt(): number;
37
37
  }
38
38
  declare class Problem {
39
39
  id: string;
@@ -74,7 +74,7 @@ declare class TeamProblemStatistics {
74
74
  get solvedTimestampToMinute(): number;
75
75
  }
76
76
 
77
- declare function calcDict(attemptedNum: number, solvedNum: number): number;
77
+ declare function calcDirt(attemptedNum: number, solvedNum: number): number;
78
78
 
79
79
  declare function createDayJS(time?: Date | string | number | undefined): dayjs.Dayjs;
80
80
  declare function getTimestamp(time: number | dayjs.Dayjs): number;
@@ -163,10 +163,11 @@ declare class Team {
163
163
  submissions: Submissions;
164
164
  placeChartPoints: Array<PlaceChartPointData>;
165
165
  awards: MedalType[];
166
+ location?: string;
166
167
  constructor();
167
168
  reset(): void;
168
169
  get penaltyToMinute(): number;
169
- get dict(): number;
170
+ get dirt(): number;
170
171
  get membersToString(): string | undefined;
171
172
  calcSolvedData(): void;
172
173
  calcAwards(awards?: Award[]): void;
@@ -287,4 +288,4 @@ declare function isRejected(status: SubmissionStatus): boolean;
287
288
  declare function isPending(status: SubmissionStatus): boolean;
288
289
  declare function isNotCalculatedPenaltyStatus(status: SubmissionStatus): boolean;
289
290
 
290
- export { Award, Awards, CodeforcesGymGhostDATConverter, Contest, ContestIndex, ContestIndexConfig, ContestIndexList, GeneralExcelConverter, MedalType, PlaceChartPointData, Problem, ProblemStatistics, Problems, Rank, RankOptions, RankStatistics, Resolver, SelectOptionItem, Submission, Submissions, Team, TeamProblemStatistics, Teams, calcDict, createContest, createContestIndex, createContestIndexList, createDayJS, createProblem, createProblems, createProblemsByProblemIds, createSubmission, createSubmissions, createTeam, createTeams, getImageSource, getTimeDiff, getTimestamp, isAccepted, isNotCalculatedPenaltyStatus, isPending, isRejected, isValidMedalType, stringToSubmissionStatus };
291
+ export { Award, Awards, CodeforcesGymGhostDATConverter, Contest, ContestIndex, ContestIndexConfig, ContestIndexList, GeneralExcelConverter, MedalType, PlaceChartPointData, Problem, ProblemStatistics, Problems, Rank, RankOptions, RankStatistics, Resolver, SelectOptionItem, Submission, Submissions, Team, TeamProblemStatistics, Teams, calcDirt, createContest, createContestIndex, createContestIndexList, createDayJS, createProblem, createProblems, createProblemsByProblemIds, createSubmission, createSubmissions, createTeam, createTeams, getImageSource, getTimeDiff, getTimestamp, isAccepted, isNotCalculatedPenaltyStatus, isPending, isRejected, isValidMedalType, stringToSubmissionStatus };
package/dist/index.mjs CHANGED
@@ -111,6 +111,7 @@ function isPending(status) {
111
111
  const pendingArray = [
112
112
  SubmissionStatus.PENDING,
113
113
  SubmissionStatus.WAITING,
114
+ SubmissionStatus.COMPILING,
114
115
  SubmissionStatus.JUDGING,
115
116
  SubmissionStatus.FROZEN
116
117
  ];
@@ -377,7 +378,7 @@ class GeneralExcelConverter {
377
378
  head.push(`${rank.contest.organization} Rank`);
378
379
  head.push(rank.contest.organization);
379
380
  }
380
- head.push("Name", "Solved", "Penalty", ...rank.contest.problems.map((p) => p.label), "Dict");
381
+ head.push("Name", "Solved", "Penalty", ...rank.contest.problems.map((p) => p.label), "Dirt");
381
382
  if (enableAwards) {
382
383
  head.push("Medal");
383
384
  }
@@ -409,7 +410,7 @@ class GeneralExcelConverter {
409
410
  arr.push(`? ${p.failedCount} + ${p.pendingCount}`);
410
411
  }
411
412
  }
412
- arr.push(`${team.dict}%`);
413
+ arr.push(`${team.dirt}%`);
413
414
  if (enableAwards) {
414
415
  const medals = team.awards.filter((a) => isValidMedalType(a)).map((a) => a.toString());
415
416
  arr.push(medals.join(", "));
@@ -420,7 +421,7 @@ class GeneralExcelConverter {
420
421
  }
421
422
  }
422
423
 
423
- function calcDict(attemptedNum, solvedNum) {
424
+ function calcDirt(attemptedNum, solvedNum) {
424
425
  if (solvedNum === 0) {
425
426
  return 0;
426
427
  }
@@ -448,11 +449,11 @@ class ProblemStatistics {
448
449
  this.firstSolveSubmissions = [];
449
450
  this.lastSolveSubmissions = [];
450
451
  }
451
- get dict() {
452
+ get dirt() {
452
453
  if (this.acceptedNum === 0) {
453
454
  return 0;
454
455
  }
455
- return calcDict(this.attemptedNum, this.acceptedNum);
456
+ return calcDirt(this.attemptedNum, this.acceptedNum);
456
457
  }
457
458
  }
458
459
  class Problem {
@@ -863,10 +864,10 @@ class Team {
863
864
  get penaltyToMinute() {
864
865
  return Math.floor(this.penalty / 60);
865
866
  }
866
- get dict() {
867
+ get dirt() {
867
868
  const attemptedNum = this.attemptedProblemNum;
868
869
  const solvedNum = this.solvedProblemNum;
869
- return calcDict(attemptedNum, solvedNum);
870
+ return calcDirt(attemptedNum, solvedNum);
870
871
  }
871
872
  get membersToString() {
872
873
  if (typeof this.members === "string") {
@@ -964,6 +965,9 @@ function createTeam(teamJSON) {
964
965
  }
965
966
  t.group = [...new Set(t.group)];
966
967
  t.group.sort();
968
+ if (teamJSON.location) {
969
+ t.location = teamJSON.location;
970
+ }
967
971
  return t;
968
972
  }
969
973
  function createTeams(teamsJSON) {
@@ -1398,4 +1402,4 @@ class Resolver extends Rank {
1398
1402
  }
1399
1403
  }
1400
1404
 
1401
- export { Award, CodeforcesGymGhostDATConverter, Contest, ContestIndex, ContestIndexConfig, GeneralExcelConverter, MedalType, PlaceChartPointData, Problem, ProblemStatistics, Rank, RankOptions, RankStatistics, Resolver, Submission, Team, TeamProblemStatistics, calcDict, createContest, createContestIndex, createContestIndexList, createDayJS, createProblem, createProblems, createProblemsByProblemIds, createSubmission, createSubmissions, createTeam, createTeams, getImageSource, getTimeDiff, getTimestamp, isAccepted, isNotCalculatedPenaltyStatus, isPending, isRejected, isValidMedalType, stringToSubmissionStatus };
1405
+ export { Award, CodeforcesGymGhostDATConverter, Contest, ContestIndex, ContestIndexConfig, GeneralExcelConverter, MedalType, PlaceChartPointData, Problem, ProblemStatistics, Rank, RankOptions, RankStatistics, Resolver, Submission, Team, TeamProblemStatistics, calcDirt, createContest, createContestIndex, createContestIndexList, createDayJS, createProblem, createProblems, createProblemsByProblemIds, createSubmission, createSubmissions, createTeam, createTeams, getImageSource, getTimeDiff, getTimestamp, isAccepted, isNotCalculatedPenaltyStatus, isPending, isRejected, isValidMedalType, stringToSubmissionStatus };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xcpcio/core",
3
- "version": "0.15.0",
3
+ "version": "0.17.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.15.0"
47
+ "@xcpcio/types": "0.17.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@babel/types": "^7.22.4",
@@ -124,7 +124,7 @@ export class GeneralExcelConverter {
124
124
  head.push(rank.contest.organization);
125
125
  }
126
126
 
127
- head.push("Name", "Solved", "Penalty", ...rank.contest.problems.map(p => p.label), "Dict");
127
+ head.push("Name", "Solved", "Penalty", ...rank.contest.problems.map(p => p.label), "Dirt");
128
128
 
129
129
  if (enableAwards) {
130
130
  head.push("Medal");
@@ -167,7 +167,7 @@ export class GeneralExcelConverter {
167
167
  }
168
168
  }
169
169
 
170
- arr.push(`${team.dict}%`);
170
+ arr.push(`${team.dirt}%`);
171
171
 
172
172
  if (enableAwards) {
173
173
  const medals = team.awards
package/src/problem.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { BalloonColor, Problem as IProblem, Problems as IProblems } from "@xcpcio/types";
2
2
 
3
3
  import type { Submissions } from "./submission";
4
- import { calcDict } from "./utils";
4
+ import { calcDirt } from "./utils";
5
5
 
6
6
  export class ProblemStatistics {
7
7
  acceptedNum: number;
@@ -41,12 +41,12 @@ export class ProblemStatistics {
41
41
  this.lastSolveSubmissions = [];
42
42
  }
43
43
 
44
- get dict() {
44
+ get dirt() {
45
45
  if (this.acceptedNum === 0) {
46
46
  return 0;
47
47
  }
48
48
 
49
- return calcDict(this.attemptedNum, this.acceptedNum);
49
+ return calcDirt(this.attemptedNum, this.acceptedNum);
50
50
  }
51
51
  }
52
52
 
@@ -128,6 +128,7 @@ export function isPending(status: SubmissionStatus): boolean {
128
128
  const pendingArray = [
129
129
  SubmissionStatus.PENDING,
130
130
  SubmissionStatus.WAITING,
131
+ SubmissionStatus.COMPILING,
131
132
  SubmissionStatus.JUDGING,
132
133
  SubmissionStatus.FROZEN,
133
134
  ];
package/src/team.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { Team as ITeam, Teams as ITeams, Image } from "@xcpcio/types";
2
2
 
3
3
  import type { Problem, TeamProblemStatistics } from "./problem";
4
- import { calcDict } from "./utils";
4
+ import { calcDirt } from "./utils";
5
5
  import type { Submissions } from "./submission";
6
6
  import type { Award, MedalType } from "./award";
7
7
 
@@ -51,6 +51,8 @@ export class Team {
51
51
 
52
52
  awards: MedalType[];
53
53
 
54
+ location?: string;
55
+
54
56
  constructor() {
55
57
  this.id = "";
56
58
  this.name = "";
@@ -109,11 +111,11 @@ export class Team {
109
111
  return Math.floor(this.penalty / 60);
110
112
  }
111
113
 
112
- get dict() {
114
+ get dirt() {
113
115
  const attemptedNum = this.attemptedProblemNum;
114
116
  const solvedNum = this.solvedProblemNum;
115
117
 
116
- return calcDict(attemptedNum, solvedNum);
118
+ return calcDirt(attemptedNum, solvedNum);
117
119
  }
118
120
 
119
121
  get membersToString() {
@@ -244,6 +246,10 @@ export function createTeam(teamJSON: ITeam): Team {
244
246
  t.group = [...new Set(t.group)];
245
247
  t.group.sort();
246
248
 
249
+ if (teamJSON.location) {
250
+ t.location = teamJSON.location;
251
+ }
252
+
247
253
  return t;
248
254
  }
249
255
 
package/src/utils/calc.ts CHANGED
@@ -1,4 +1,4 @@
1
- export function calcDict(attemptedNum: number, solvedNum: number) {
1
+ export function calcDirt(attemptedNum: number, solvedNum: number) {
2
2
  if (solvedNum === 0) {
3
3
  return 0;
4
4
  }