@xcpcio/core 0.16.0 → 0.18.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 +9 -9
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +9 -9
- package/package.json +2 -2
- package/src/export/general-excel.ts +2 -2
- package/src/image.ts +1 -1
- package/src/problem.ts +3 -3
- package/src/team.ts +3 -3
- package/src/utils/calc.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -408,7 +408,7 @@ class GeneralExcelConverter {
|
|
|
408
408
|
head.push(`${rank.contest.organization} Rank`);
|
|
409
409
|
head.push(rank.contest.organization);
|
|
410
410
|
}
|
|
411
|
-
head.push("Name", "Solved", "Penalty", ...rank.contest.problems.map((p) => p.label), "
|
|
411
|
+
head.push("Name", "Solved", "Penalty", ...rank.contest.problems.map((p) => p.label), "Dirt");
|
|
412
412
|
if (enableAwards) {
|
|
413
413
|
head.push("Medal");
|
|
414
414
|
}
|
|
@@ -440,7 +440,7 @@ class GeneralExcelConverter {
|
|
|
440
440
|
arr.push(`? ${p.failedCount} + ${p.pendingCount}`);
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
|
-
arr.push(`${team.
|
|
443
|
+
arr.push(`${team.dirt}%`);
|
|
444
444
|
if (enableAwards) {
|
|
445
445
|
const medals = team.awards.filter((a) => isValidMedalType(a)).map((a) => a.toString());
|
|
446
446
|
arr.push(medals.join(", "));
|
|
@@ -451,7 +451,7 @@ class GeneralExcelConverter {
|
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
453
|
|
|
454
|
-
function
|
|
454
|
+
function calcDirt(attemptedNum, solvedNum) {
|
|
455
455
|
if (solvedNum === 0) {
|
|
456
456
|
return 0;
|
|
457
457
|
}
|
|
@@ -479,11 +479,11 @@ class ProblemStatistics {
|
|
|
479
479
|
this.firstSolveSubmissions = [];
|
|
480
480
|
this.lastSolveSubmissions = [];
|
|
481
481
|
}
|
|
482
|
-
get
|
|
482
|
+
get dirt() {
|
|
483
483
|
if (this.acceptedNum === 0) {
|
|
484
484
|
return 0;
|
|
485
485
|
}
|
|
486
|
-
return
|
|
486
|
+
return calcDirt(this.attemptedNum, this.acceptedNum);
|
|
487
487
|
}
|
|
488
488
|
}
|
|
489
489
|
class Problem {
|
|
@@ -832,7 +832,7 @@ function getImageSource(image) {
|
|
|
832
832
|
return image.url;
|
|
833
833
|
}
|
|
834
834
|
if (image?.base64) {
|
|
835
|
-
return `data:image/${image.type};base64,${image.base64}`;
|
|
835
|
+
return `data:image/${image.type ?? "png"};base64,${image.base64}`;
|
|
836
836
|
}
|
|
837
837
|
return "";
|
|
838
838
|
}
|
|
@@ -894,10 +894,10 @@ class Team {
|
|
|
894
894
|
get penaltyToMinute() {
|
|
895
895
|
return Math.floor(this.penalty / 60);
|
|
896
896
|
}
|
|
897
|
-
get
|
|
897
|
+
get dirt() {
|
|
898
898
|
const attemptedNum = this.attemptedProblemNum;
|
|
899
899
|
const solvedNum = this.solvedProblemNum;
|
|
900
|
-
return
|
|
900
|
+
return calcDirt(attemptedNum, solvedNum);
|
|
901
901
|
}
|
|
902
902
|
get membersToString() {
|
|
903
903
|
if (typeof this.members === "string") {
|
|
@@ -1450,7 +1450,7 @@ exports.Resolver = Resolver;
|
|
|
1450
1450
|
exports.Submission = Submission;
|
|
1451
1451
|
exports.Team = Team;
|
|
1452
1452
|
exports.TeamProblemStatistics = TeamProblemStatistics;
|
|
1453
|
-
exports.
|
|
1453
|
+
exports.calcDirt = calcDirt;
|
|
1454
1454
|
exports.createContest = createContest;
|
|
1455
1455
|
exports.createContestIndex = createContestIndex;
|
|
1456
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
|
|
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
|
|
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;
|
|
@@ -167,7 +167,7 @@ declare class Team {
|
|
|
167
167
|
constructor();
|
|
168
168
|
reset(): void;
|
|
169
169
|
get penaltyToMinute(): number;
|
|
170
|
-
get
|
|
170
|
+
get dirt(): number;
|
|
171
171
|
get membersToString(): string | undefined;
|
|
172
172
|
calcSolvedData(): void;
|
|
173
173
|
calcAwards(awards?: Award[]): void;
|
|
@@ -288,4 +288,4 @@ declare function isRejected(status: SubmissionStatus): boolean;
|
|
|
288
288
|
declare function isPending(status: SubmissionStatus): boolean;
|
|
289
289
|
declare function isNotCalculatedPenaltyStatus(status: SubmissionStatus): boolean;
|
|
290
290
|
|
|
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,
|
|
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
|
@@ -378,7 +378,7 @@ class GeneralExcelConverter {
|
|
|
378
378
|
head.push(`${rank.contest.organization} Rank`);
|
|
379
379
|
head.push(rank.contest.organization);
|
|
380
380
|
}
|
|
381
|
-
head.push("Name", "Solved", "Penalty", ...rank.contest.problems.map((p) => p.label), "
|
|
381
|
+
head.push("Name", "Solved", "Penalty", ...rank.contest.problems.map((p) => p.label), "Dirt");
|
|
382
382
|
if (enableAwards) {
|
|
383
383
|
head.push("Medal");
|
|
384
384
|
}
|
|
@@ -410,7 +410,7 @@ class GeneralExcelConverter {
|
|
|
410
410
|
arr.push(`? ${p.failedCount} + ${p.pendingCount}`);
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
|
-
arr.push(`${team.
|
|
413
|
+
arr.push(`${team.dirt}%`);
|
|
414
414
|
if (enableAwards) {
|
|
415
415
|
const medals = team.awards.filter((a) => isValidMedalType(a)).map((a) => a.toString());
|
|
416
416
|
arr.push(medals.join(", "));
|
|
@@ -421,7 +421,7 @@ class GeneralExcelConverter {
|
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
-
function
|
|
424
|
+
function calcDirt(attemptedNum, solvedNum) {
|
|
425
425
|
if (solvedNum === 0) {
|
|
426
426
|
return 0;
|
|
427
427
|
}
|
|
@@ -449,11 +449,11 @@ class ProblemStatistics {
|
|
|
449
449
|
this.firstSolveSubmissions = [];
|
|
450
450
|
this.lastSolveSubmissions = [];
|
|
451
451
|
}
|
|
452
|
-
get
|
|
452
|
+
get dirt() {
|
|
453
453
|
if (this.acceptedNum === 0) {
|
|
454
454
|
return 0;
|
|
455
455
|
}
|
|
456
|
-
return
|
|
456
|
+
return calcDirt(this.attemptedNum, this.acceptedNum);
|
|
457
457
|
}
|
|
458
458
|
}
|
|
459
459
|
class Problem {
|
|
@@ -802,7 +802,7 @@ function getImageSource(image) {
|
|
|
802
802
|
return image.url;
|
|
803
803
|
}
|
|
804
804
|
if (image?.base64) {
|
|
805
|
-
return `data:image/${image.type};base64,${image.base64}`;
|
|
805
|
+
return `data:image/${image.type ?? "png"};base64,${image.base64}`;
|
|
806
806
|
}
|
|
807
807
|
return "";
|
|
808
808
|
}
|
|
@@ -864,10 +864,10 @@ class Team {
|
|
|
864
864
|
get penaltyToMinute() {
|
|
865
865
|
return Math.floor(this.penalty / 60);
|
|
866
866
|
}
|
|
867
|
-
get
|
|
867
|
+
get dirt() {
|
|
868
868
|
const attemptedNum = this.attemptedProblemNum;
|
|
869
869
|
const solvedNum = this.solvedProblemNum;
|
|
870
|
-
return
|
|
870
|
+
return calcDirt(attemptedNum, solvedNum);
|
|
871
871
|
}
|
|
872
872
|
get membersToString() {
|
|
873
873
|
if (typeof this.members === "string") {
|
|
@@ -1402,4 +1402,4 @@ class Resolver extends Rank {
|
|
|
1402
1402
|
}
|
|
1403
1403
|
}
|
|
1404
1404
|
|
|
1405
|
-
export { Award, CodeforcesGymGhostDATConverter, Contest, ContestIndex, ContestIndexConfig, GeneralExcelConverter, MedalType, PlaceChartPointData, Problem, ProblemStatistics, Rank, RankOptions, RankStatistics, Resolver, Submission, Team, TeamProblemStatistics,
|
|
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.
|
|
3
|
+
"version": "0.18.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.
|
|
47
|
+
"@xcpcio/types": "0.18.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), "
|
|
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.
|
|
170
|
+
arr.push(`${team.dirt}%`);
|
|
171
171
|
|
|
172
172
|
if (enableAwards) {
|
|
173
173
|
const medals = team.awards
|
package/src/image.ts
CHANGED
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 {
|
|
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
|
|
44
|
+
get dirt() {
|
|
45
45
|
if (this.acceptedNum === 0) {
|
|
46
46
|
return 0;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
return
|
|
49
|
+
return calcDirt(this.attemptedNum, this.acceptedNum);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
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 {
|
|
4
|
+
import { calcDirt } from "./utils";
|
|
5
5
|
import type { Submissions } from "./submission";
|
|
6
6
|
import type { Award, MedalType } from "./award";
|
|
7
7
|
|
|
@@ -111,11 +111,11 @@ export class Team {
|
|
|
111
111
|
return Math.floor(this.penalty / 60);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
get
|
|
114
|
+
get dirt() {
|
|
115
115
|
const attemptedNum = this.attemptedProblemNum;
|
|
116
116
|
const solvedNum = this.solvedProblemNum;
|
|
117
117
|
|
|
118
|
-
return
|
|
118
|
+
return calcDirt(attemptedNum, solvedNum);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
get membersToString() {
|
package/src/utils/calc.ts
CHANGED