@xcpcio/core 0.78.7 → 0.79.1
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 +74 -47
- package/dist/index.d.cts +99 -97
- package/dist/index.d.mts +99 -97
- package/dist/index.d.ts +99 -97
- package/dist/index.mjs +74 -47
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1053,6 +1053,7 @@ class BattleOfGiants {
|
|
|
1053
1053
|
}
|
|
1054
1054
|
|
|
1055
1055
|
class ContestOptions {
|
|
1056
|
+
enableOrganization;
|
|
1056
1057
|
calculationOfPenalty;
|
|
1057
1058
|
submissionTimestampUnit;
|
|
1058
1059
|
submissionHasTimeField;
|
|
@@ -1066,6 +1067,7 @@ class ContestOptions {
|
|
|
1066
1067
|
teamWebcamStreamUrlTemplate;
|
|
1067
1068
|
teamScreenStreamUrlTemplate;
|
|
1068
1069
|
constructor() {
|
|
1070
|
+
this.enableOrganization = false;
|
|
1069
1071
|
this.calculationOfPenalty = "in_minutes";
|
|
1070
1072
|
this.submissionTimestampUnit = "second";
|
|
1071
1073
|
this.submissionHasTimeField = false;
|
|
@@ -1078,6 +1080,7 @@ class ContestOptions {
|
|
|
1078
1080
|
function createContestOptions(contestOptionsJSON = {}) {
|
|
1079
1081
|
const j = contestOptionsJSON;
|
|
1080
1082
|
const o = new ContestOptions();
|
|
1083
|
+
o.enableOrganization = !!j.enable_organization;
|
|
1081
1084
|
if (j.calculation_of_penalty) {
|
|
1082
1085
|
o.calculationOfPenalty = j.calculation_of_penalty;
|
|
1083
1086
|
}
|
|
@@ -1108,6 +1111,44 @@ class Group {
|
|
|
1108
1111
|
}
|
|
1109
1112
|
}
|
|
1110
1113
|
|
|
1114
|
+
class Organization {
|
|
1115
|
+
id;
|
|
1116
|
+
name;
|
|
1117
|
+
logo;
|
|
1118
|
+
icpcID;
|
|
1119
|
+
// Teams belonging to this organization
|
|
1120
|
+
teams;
|
|
1121
|
+
rank;
|
|
1122
|
+
constructor() {
|
|
1123
|
+
this.id = "";
|
|
1124
|
+
this.name = new I18nText();
|
|
1125
|
+
this.teams = [];
|
|
1126
|
+
this.rank = -1;
|
|
1127
|
+
}
|
|
1128
|
+
reset() {
|
|
1129
|
+
this.rank = -1;
|
|
1130
|
+
}
|
|
1131
|
+
static compare(lhs, rhs) {
|
|
1132
|
+
if (lhs.id < rhs.id) {
|
|
1133
|
+
return -1;
|
|
1134
|
+
} else if (lhs.id > rhs.id) {
|
|
1135
|
+
return 1;
|
|
1136
|
+
}
|
|
1137
|
+
return 0;
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
function createOrganization(orgJSON) {
|
|
1141
|
+
const org = new Organization();
|
|
1142
|
+
org.id = orgJSON.id;
|
|
1143
|
+
org.name = I18nText.fromIText(orgJSON.name);
|
|
1144
|
+
org.logo = orgJSON.logo;
|
|
1145
|
+
org.icpcID = orgJSON.icpc_id;
|
|
1146
|
+
return org;
|
|
1147
|
+
}
|
|
1148
|
+
function createOrganizations(orgsJSON) {
|
|
1149
|
+
return orgsJSON.map((org) => createOrganization(org));
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1111
1152
|
class Contest {
|
|
1112
1153
|
id = "";
|
|
1113
1154
|
name;
|
|
@@ -1126,7 +1167,6 @@ class Contest {
|
|
|
1126
1167
|
problems;
|
|
1127
1168
|
problemsMap;
|
|
1128
1169
|
statusTimeDisplay;
|
|
1129
|
-
badge;
|
|
1130
1170
|
organization;
|
|
1131
1171
|
medal;
|
|
1132
1172
|
awards;
|
|
@@ -1137,6 +1177,7 @@ class Contest {
|
|
|
1137
1177
|
bannerMode;
|
|
1138
1178
|
boardLink;
|
|
1139
1179
|
options;
|
|
1180
|
+
organizations;
|
|
1140
1181
|
constructor() {
|
|
1141
1182
|
this.name = new I18nText();
|
|
1142
1183
|
this.startTime = createDayJS();
|
|
@@ -1288,7 +1329,6 @@ function createContest(contestJSON) {
|
|
|
1288
1329
|
pending: Boolean(contestJSON.status_time_display.pending ?? false)
|
|
1289
1330
|
};
|
|
1290
1331
|
}
|
|
1291
|
-
c.badge = contestJSON.badge;
|
|
1292
1332
|
c.organization = contestJSON.organization;
|
|
1293
1333
|
c.medal = contestJSON.medal;
|
|
1294
1334
|
(() => {
|
|
@@ -1361,6 +1401,12 @@ function createContest(contestJSON) {
|
|
|
1361
1401
|
if (contestJSON.options) {
|
|
1362
1402
|
c.options = createContestOptions(contestJSON.options);
|
|
1363
1403
|
}
|
|
1404
|
+
if (c.organization) {
|
|
1405
|
+
c.options.enableOrganization = true;
|
|
1406
|
+
}
|
|
1407
|
+
if (contestJSON.organizations) {
|
|
1408
|
+
c.organizations = createOrganizations(contestJSON.organizations);
|
|
1409
|
+
}
|
|
1364
1410
|
return c;
|
|
1365
1411
|
}
|
|
1366
1412
|
|
|
@@ -1638,9 +1684,9 @@ class GeneralExcelConverter {
|
|
|
1638
1684
|
{
|
|
1639
1685
|
const head = [];
|
|
1640
1686
|
head.push("Rank");
|
|
1641
|
-
if (rank.contest.
|
|
1642
|
-
head.push(
|
|
1643
|
-
head.push(
|
|
1687
|
+
if (rank.contest.options.enableOrganization) {
|
|
1688
|
+
head.push("Organization Rank");
|
|
1689
|
+
head.push("Organization");
|
|
1644
1690
|
}
|
|
1645
1691
|
head.push("Team", "Solved", "Penalty", ...rank.contest.problems.map((p) => p.label), "Dirt");
|
|
1646
1692
|
if (enableAwards) {
|
|
@@ -1781,49 +1827,14 @@ function getImageSource(image, data_host) {
|
|
|
1781
1827
|
return `${normalizePath(data_host)}${image.url}`;
|
|
1782
1828
|
}
|
|
1783
1829
|
if (image?.base64) {
|
|
1830
|
+
if (image.mime) {
|
|
1831
|
+
return `data:${image.mime};base64,${image.base64}`;
|
|
1832
|
+
}
|
|
1784
1833
|
return `data:image/${image.type ?? "png"};base64,${image.base64}`;
|
|
1785
1834
|
}
|
|
1786
1835
|
return "";
|
|
1787
1836
|
}
|
|
1788
1837
|
|
|
1789
|
-
class Organization {
|
|
1790
|
-
id;
|
|
1791
|
-
name;
|
|
1792
|
-
logo;
|
|
1793
|
-
icpcID;
|
|
1794
|
-
// Teams belonging to this organization
|
|
1795
|
-
teams;
|
|
1796
|
-
rank;
|
|
1797
|
-
constructor() {
|
|
1798
|
-
this.id = "";
|
|
1799
|
-
this.name = new I18nText();
|
|
1800
|
-
this.teams = [];
|
|
1801
|
-
this.rank = -1;
|
|
1802
|
-
}
|
|
1803
|
-
reset() {
|
|
1804
|
-
this.rank = -1;
|
|
1805
|
-
}
|
|
1806
|
-
static compare(lhs, rhs) {
|
|
1807
|
-
if (lhs.id < rhs.id) {
|
|
1808
|
-
return -1;
|
|
1809
|
-
} else if (lhs.id > rhs.id) {
|
|
1810
|
-
return 1;
|
|
1811
|
-
}
|
|
1812
|
-
return 0;
|
|
1813
|
-
}
|
|
1814
|
-
}
|
|
1815
|
-
function createOrganization(orgJSON) {
|
|
1816
|
-
const org = new Organization();
|
|
1817
|
-
org.id = orgJSON.id;
|
|
1818
|
-
org.name = I18nText.fromIText(orgJSON.name);
|
|
1819
|
-
org.logo = orgJSON.logo;
|
|
1820
|
-
org.icpcID = orgJSON.icpc_id;
|
|
1821
|
-
return org;
|
|
1822
|
-
}
|
|
1823
|
-
function createOrganizations(orgsJSON) {
|
|
1824
|
-
return orgsJSON.map((org) => createOrganization(org));
|
|
1825
|
-
}
|
|
1826
|
-
|
|
1827
1838
|
class RankStatistics {
|
|
1828
1839
|
teamSolvedNum;
|
|
1829
1840
|
teamSolvedNumIndex;
|
|
@@ -1974,8 +1985,16 @@ class Rank {
|
|
|
1974
1985
|
});
|
|
1975
1986
|
}
|
|
1976
1987
|
this.submissionsMap = new Map(this.submissions.map((s) => [s.id, s]));
|
|
1977
|
-
|
|
1978
|
-
|
|
1988
|
+
if (this.contest.organizations) {
|
|
1989
|
+
this.organizations = this.contest.organizations;
|
|
1990
|
+
this.organizationsMap = new Map(
|
|
1991
|
+
this.organizations.map((org) => [org.id, org])
|
|
1992
|
+
);
|
|
1993
|
+
this.linkTeamAndOrg();
|
|
1994
|
+
} else {
|
|
1995
|
+
this.organizationsMap = this.buildOrganizationsMap();
|
|
1996
|
+
this.organizations = [...this.organizationsMap.values()];
|
|
1997
|
+
}
|
|
1979
1998
|
this.organizations.sort(Organization.compare);
|
|
1980
1999
|
this.originTeams = this.teams.map((t) => t);
|
|
1981
2000
|
this.originTeams.sort(Team.compare);
|
|
@@ -1999,8 +2018,16 @@ class Rank {
|
|
|
1999
2018
|
this.statuses = [...se].sort();
|
|
2000
2019
|
}
|
|
2001
2020
|
}
|
|
2021
|
+
linkTeamAndOrg() {
|
|
2022
|
+
this.teams.forEach((t) => {
|
|
2023
|
+
if (!t.organizationId) {
|
|
2024
|
+
return;
|
|
2025
|
+
}
|
|
2026
|
+
t.organization = this.organizationsMap.get(t.organizationId);
|
|
2027
|
+
});
|
|
2028
|
+
}
|
|
2002
2029
|
buildOrganizationsMap() {
|
|
2003
|
-
if (!this.contest.
|
|
2030
|
+
if (!this.contest.options.enableOrganization) {
|
|
2004
2031
|
return /* @__PURE__ */ new Map();
|
|
2005
2032
|
}
|
|
2006
2033
|
const res = /* @__PURE__ */ new Map();
|
|
@@ -2186,7 +2213,7 @@ class Rank {
|
|
|
2186
2213
|
}
|
|
2187
2214
|
}
|
|
2188
2215
|
buildOrgRank() {
|
|
2189
|
-
if (!this.contest.
|
|
2216
|
+
if (!this.contest.options.enableOrganization) {
|
|
2190
2217
|
return;
|
|
2191
2218
|
}
|
|
2192
2219
|
let rank = 1;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CalculationOfPenalty, TimeUnit, Image, Lang, I18NStringSet, Text, Person as Person$1, Persons as Persons$1, Team as Team$1, Teams as Teams$1, Organization as Organization$1, Organizations as Organizations$1, StatusTimeDisplay, MedalPreset, BannerMode, ContestState, Contest as Contest$1, SubmissionReaction, SubmissionStatus, Submission as Submission$1, Submissions as Submissions$1, BalloonColor, Problem as Problem$1, Problems as Problems$1, ContestIndex as ContestIndex$1, IRatingHistory, IRatingUser, IRating } from '@xcpcio/types';
|
|
2
2
|
import dayjs from 'dayjs';
|
|
3
3
|
export { default as dayjs } from 'dayjs';
|
|
4
4
|
import * as XLSX from 'xlsx-js-style';
|
|
@@ -19,6 +19,23 @@ declare class Award {
|
|
|
19
19
|
declare function isValidMedalType(medal: MedalType): boolean;
|
|
20
20
|
type Awards = Map<string, Award[]>;
|
|
21
21
|
|
|
22
|
+
declare class ContestOptions {
|
|
23
|
+
enableOrganization: boolean;
|
|
24
|
+
calculationOfPenalty: CalculationOfPenalty;
|
|
25
|
+
submissionTimestampUnit: TimeUnit;
|
|
26
|
+
submissionHasTimeField: boolean;
|
|
27
|
+
submissionHasLanguageField: boolean;
|
|
28
|
+
submissionEnableActionField: boolean;
|
|
29
|
+
submissionHasReactionField: boolean;
|
|
30
|
+
submissionHasExternalUrlField: boolean;
|
|
31
|
+
reactionVideoUrlTemplate?: string;
|
|
32
|
+
submissionExternalUrlTemplate?: string;
|
|
33
|
+
teamPhotoTemplate?: Image;
|
|
34
|
+
teamWebcamStreamUrlTemplate?: string;
|
|
35
|
+
teamScreenStreamUrlTemplate?: string;
|
|
36
|
+
constructor();
|
|
37
|
+
}
|
|
38
|
+
|
|
22
39
|
interface SelectOptionItem {
|
|
23
40
|
value: string;
|
|
24
41
|
text: string;
|
|
@@ -38,21 +55,87 @@ declare class I18nText {
|
|
|
38
55
|
valueOf(): string;
|
|
39
56
|
}
|
|
40
57
|
|
|
41
|
-
declare class
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
declare class Person {
|
|
59
|
+
name: I18nText;
|
|
60
|
+
cfID?: string;
|
|
61
|
+
icpcID?: string;
|
|
62
|
+
constructor(name?: I18nText);
|
|
63
|
+
toIPerson(): Person$1;
|
|
64
|
+
static fromIPerson(iPerson: Person$1): Person;
|
|
65
|
+
}
|
|
66
|
+
type Persons = Array<Person>;
|
|
67
|
+
declare function createPersons(iPersons?: Text | Array<Text> | Persons$1): Persons;
|
|
68
|
+
|
|
69
|
+
declare class PlaceChartPointData {
|
|
70
|
+
timePoint: number;
|
|
71
|
+
rank: number;
|
|
72
|
+
lastSolvedProblem: Problem | null;
|
|
73
|
+
constructor();
|
|
74
|
+
}
|
|
75
|
+
declare class Team {
|
|
76
|
+
id: string;
|
|
77
|
+
name: I18nText;
|
|
78
|
+
organizationId?: string;
|
|
79
|
+
organizationName?: string;
|
|
80
|
+
organization?: Organization;
|
|
81
|
+
isFirstRankOfOrganization: boolean;
|
|
82
|
+
group: Array<string>;
|
|
83
|
+
tag: Array<string>;
|
|
84
|
+
coaches: Persons;
|
|
85
|
+
members: Persons;
|
|
86
|
+
rank: number;
|
|
87
|
+
originalRank: number;
|
|
88
|
+
solvedProblemNum: number;
|
|
89
|
+
attemptedProblemNum: number;
|
|
90
|
+
lastSolvedProblem: Problem | null;
|
|
91
|
+
lastSolvedProblemStatistics: TeamProblemStatistics | null;
|
|
92
|
+
penalty: number;
|
|
93
|
+
problemStatistics: Array<TeamProblemStatistics>;
|
|
94
|
+
problemStatisticsMap: Map<string, TeamProblemStatistics>;
|
|
95
|
+
submissions: Submissions;
|
|
96
|
+
placeChartPoints: Array<PlaceChartPointData>;
|
|
97
|
+
awards: MedalType[];
|
|
98
|
+
badge?: Image;
|
|
99
|
+
missingPhoto: boolean;
|
|
100
|
+
photo?: Image;
|
|
101
|
+
location?: string;
|
|
102
|
+
icpcID?: string;
|
|
103
|
+
ip?: string;
|
|
104
|
+
se: number;
|
|
105
|
+
constructor();
|
|
106
|
+
reset(): void;
|
|
107
|
+
get penaltyToMinute(): number;
|
|
108
|
+
get isUnofficial(): boolean;
|
|
109
|
+
get isGirl(): boolean;
|
|
110
|
+
get isEffectiveTeam(): boolean;
|
|
111
|
+
get dirt(): number;
|
|
112
|
+
membersToString(lang?: Lang): string;
|
|
113
|
+
coachesToString(lang?: Lang): string;
|
|
114
|
+
calcSE(totalTeams: number): number;
|
|
115
|
+
calcSolvedData(options: ContestOptions): void;
|
|
116
|
+
calcAwards(awards?: Award[]): void;
|
|
117
|
+
isEqualRank(otherTeam: Team): boolean;
|
|
118
|
+
postProcessPlaceChartPoints(): void;
|
|
119
|
+
static compare(lhs: Team, rhs: Team): number;
|
|
120
|
+
}
|
|
121
|
+
type Teams = Array<Team>;
|
|
122
|
+
declare function createTeam(teamJSON: Team$1): Team;
|
|
123
|
+
declare function createTeams(teamsJSON: Teams$1): Teams;
|
|
124
|
+
|
|
125
|
+
declare class Organization {
|
|
126
|
+
id: string;
|
|
127
|
+
name: I18nText;
|
|
128
|
+
logo?: Image;
|
|
129
|
+
icpcID?: string;
|
|
130
|
+
teams: Teams;
|
|
131
|
+
rank: number;
|
|
54
132
|
constructor();
|
|
133
|
+
reset(): void;
|
|
134
|
+
static compare(lhs: Organization, rhs: Organization): number;
|
|
55
135
|
}
|
|
136
|
+
type Organizations = Array<Organization>;
|
|
137
|
+
declare function createOrganization(orgJSON: Organization$1): Organization;
|
|
138
|
+
declare function createOrganizations(orgsJSON: Organizations$1): Organizations;
|
|
56
139
|
|
|
57
140
|
declare class Group {
|
|
58
141
|
name: I18nText;
|
|
@@ -89,7 +172,6 @@ declare class Contest {
|
|
|
89
172
|
problems: Problems;
|
|
90
173
|
problemsMap: Map<string, Problem>;
|
|
91
174
|
statusTimeDisplay: StatusTimeDisplay;
|
|
92
|
-
badge?: string;
|
|
93
175
|
organization?: string;
|
|
94
176
|
medal?: Record<string, Record<string, number>> | MedalPreset;
|
|
95
177
|
awards?: Awards;
|
|
@@ -100,6 +182,7 @@ declare class Contest {
|
|
|
100
182
|
bannerMode?: BannerMode;
|
|
101
183
|
boardLink?: string;
|
|
102
184
|
options: ContestOptions;
|
|
185
|
+
organizations?: Organizations;
|
|
103
186
|
constructor();
|
|
104
187
|
getStartTime(): dayjs.Dayjs;
|
|
105
188
|
getEndTime(): dayjs.Dayjs;
|
|
@@ -200,88 +283,6 @@ declare class TeamProblemStatistics {
|
|
|
200
283
|
get penaltyInSecond(): number;
|
|
201
284
|
}
|
|
202
285
|
|
|
203
|
-
declare class Organization {
|
|
204
|
-
id: string;
|
|
205
|
-
name: I18nText;
|
|
206
|
-
logo?: Image;
|
|
207
|
-
icpcID?: string;
|
|
208
|
-
teams: Teams;
|
|
209
|
-
rank: number;
|
|
210
|
-
constructor();
|
|
211
|
-
reset(): void;
|
|
212
|
-
static compare(lhs: Organization, rhs: Organization): number;
|
|
213
|
-
}
|
|
214
|
-
type Organizations = Array<Organization>;
|
|
215
|
-
declare function createOrganization(orgJSON: Organization$1): Organization;
|
|
216
|
-
declare function createOrganizations(orgsJSON: Organizations$1): Organizations;
|
|
217
|
-
|
|
218
|
-
declare class Person {
|
|
219
|
-
name: I18nText;
|
|
220
|
-
cfID?: string;
|
|
221
|
-
icpcID?: string;
|
|
222
|
-
constructor(name?: I18nText);
|
|
223
|
-
toIPerson(): Person$1;
|
|
224
|
-
static fromIPerson(iPerson: Person$1): Person;
|
|
225
|
-
}
|
|
226
|
-
type Persons = Array<Person>;
|
|
227
|
-
declare function createPersons(iPersons?: Text | Array<Text> | Persons$1): Persons;
|
|
228
|
-
|
|
229
|
-
declare class PlaceChartPointData {
|
|
230
|
-
timePoint: number;
|
|
231
|
-
rank: number;
|
|
232
|
-
lastSolvedProblem: Problem | null;
|
|
233
|
-
constructor();
|
|
234
|
-
}
|
|
235
|
-
declare class Team {
|
|
236
|
-
id: string;
|
|
237
|
-
name: I18nText;
|
|
238
|
-
organizationId?: string;
|
|
239
|
-
organizationName?: string;
|
|
240
|
-
organization?: Organization;
|
|
241
|
-
isFirstRankOfOrganization: boolean;
|
|
242
|
-
group: Array<string>;
|
|
243
|
-
tag: Array<string>;
|
|
244
|
-
coaches: Persons;
|
|
245
|
-
members: Persons;
|
|
246
|
-
rank: number;
|
|
247
|
-
originalRank: number;
|
|
248
|
-
solvedProblemNum: number;
|
|
249
|
-
attemptedProblemNum: number;
|
|
250
|
-
lastSolvedProblem: Problem | null;
|
|
251
|
-
lastSolvedProblemStatistics: TeamProblemStatistics | null;
|
|
252
|
-
penalty: number;
|
|
253
|
-
problemStatistics: Array<TeamProblemStatistics>;
|
|
254
|
-
problemStatisticsMap: Map<string, TeamProblemStatistics>;
|
|
255
|
-
submissions: Submissions;
|
|
256
|
-
placeChartPoints: Array<PlaceChartPointData>;
|
|
257
|
-
awards: MedalType[];
|
|
258
|
-
badge?: Image;
|
|
259
|
-
missingPhoto: boolean;
|
|
260
|
-
photo?: Image;
|
|
261
|
-
location?: string;
|
|
262
|
-
icpcID?: string;
|
|
263
|
-
ip?: string;
|
|
264
|
-
se: number;
|
|
265
|
-
constructor();
|
|
266
|
-
reset(): void;
|
|
267
|
-
get penaltyToMinute(): number;
|
|
268
|
-
get isUnofficial(): boolean;
|
|
269
|
-
get isGirl(): boolean;
|
|
270
|
-
get isEffectiveTeam(): boolean;
|
|
271
|
-
get dirt(): number;
|
|
272
|
-
membersToString(lang?: Lang): string;
|
|
273
|
-
coachesToString(lang?: Lang): string;
|
|
274
|
-
calcSE(totalTeams: number): number;
|
|
275
|
-
calcSolvedData(options: ContestOptions): void;
|
|
276
|
-
calcAwards(awards?: Award[]): void;
|
|
277
|
-
isEqualRank(otherTeam: Team): boolean;
|
|
278
|
-
postProcessPlaceChartPoints(): void;
|
|
279
|
-
static compare(lhs: Team, rhs: Team): number;
|
|
280
|
-
}
|
|
281
|
-
type Teams = Array<Team>;
|
|
282
|
-
declare function createTeam(teamJSON: Team$1): Team;
|
|
283
|
-
declare function createTeams(teamsJSON: Teams$1): Teams;
|
|
284
|
-
|
|
285
286
|
declare class Balloon {
|
|
286
287
|
problem: Problem;
|
|
287
288
|
team: Team;
|
|
@@ -398,6 +399,7 @@ declare class Rank {
|
|
|
398
399
|
languages: Array<string>;
|
|
399
400
|
statuses: Array<SubmissionStatus>;
|
|
400
401
|
constructor(contest: Contest, teams: Teams, submissions: Submissions);
|
|
402
|
+
linkTeamAndOrg(): void;
|
|
401
403
|
buildOrganizationsMap(): Map<string, Organization>;
|
|
402
404
|
cleanRank(): void;
|
|
403
405
|
buildRank(): this;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CalculationOfPenalty, TimeUnit, Image, Lang, I18NStringSet, Text, Person as Person$1, Persons as Persons$1, Team as Team$1, Teams as Teams$1, Organization as Organization$1, Organizations as Organizations$1, StatusTimeDisplay, MedalPreset, BannerMode, ContestState, Contest as Contest$1, SubmissionReaction, SubmissionStatus, Submission as Submission$1, Submissions as Submissions$1, BalloonColor, Problem as Problem$1, Problems as Problems$1, ContestIndex as ContestIndex$1, IRatingHistory, IRatingUser, IRating } from '@xcpcio/types';
|
|
2
2
|
import dayjs from 'dayjs';
|
|
3
3
|
export { default as dayjs } from 'dayjs';
|
|
4
4
|
import * as XLSX from 'xlsx-js-style';
|
|
@@ -19,6 +19,23 @@ declare class Award {
|
|
|
19
19
|
declare function isValidMedalType(medal: MedalType): boolean;
|
|
20
20
|
type Awards = Map<string, Award[]>;
|
|
21
21
|
|
|
22
|
+
declare class ContestOptions {
|
|
23
|
+
enableOrganization: boolean;
|
|
24
|
+
calculationOfPenalty: CalculationOfPenalty;
|
|
25
|
+
submissionTimestampUnit: TimeUnit;
|
|
26
|
+
submissionHasTimeField: boolean;
|
|
27
|
+
submissionHasLanguageField: boolean;
|
|
28
|
+
submissionEnableActionField: boolean;
|
|
29
|
+
submissionHasReactionField: boolean;
|
|
30
|
+
submissionHasExternalUrlField: boolean;
|
|
31
|
+
reactionVideoUrlTemplate?: string;
|
|
32
|
+
submissionExternalUrlTemplate?: string;
|
|
33
|
+
teamPhotoTemplate?: Image;
|
|
34
|
+
teamWebcamStreamUrlTemplate?: string;
|
|
35
|
+
teamScreenStreamUrlTemplate?: string;
|
|
36
|
+
constructor();
|
|
37
|
+
}
|
|
38
|
+
|
|
22
39
|
interface SelectOptionItem {
|
|
23
40
|
value: string;
|
|
24
41
|
text: string;
|
|
@@ -38,21 +55,87 @@ declare class I18nText {
|
|
|
38
55
|
valueOf(): string;
|
|
39
56
|
}
|
|
40
57
|
|
|
41
|
-
declare class
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
declare class Person {
|
|
59
|
+
name: I18nText;
|
|
60
|
+
cfID?: string;
|
|
61
|
+
icpcID?: string;
|
|
62
|
+
constructor(name?: I18nText);
|
|
63
|
+
toIPerson(): Person$1;
|
|
64
|
+
static fromIPerson(iPerson: Person$1): Person;
|
|
65
|
+
}
|
|
66
|
+
type Persons = Array<Person>;
|
|
67
|
+
declare function createPersons(iPersons?: Text | Array<Text> | Persons$1): Persons;
|
|
68
|
+
|
|
69
|
+
declare class PlaceChartPointData {
|
|
70
|
+
timePoint: number;
|
|
71
|
+
rank: number;
|
|
72
|
+
lastSolvedProblem: Problem | null;
|
|
73
|
+
constructor();
|
|
74
|
+
}
|
|
75
|
+
declare class Team {
|
|
76
|
+
id: string;
|
|
77
|
+
name: I18nText;
|
|
78
|
+
organizationId?: string;
|
|
79
|
+
organizationName?: string;
|
|
80
|
+
organization?: Organization;
|
|
81
|
+
isFirstRankOfOrganization: boolean;
|
|
82
|
+
group: Array<string>;
|
|
83
|
+
tag: Array<string>;
|
|
84
|
+
coaches: Persons;
|
|
85
|
+
members: Persons;
|
|
86
|
+
rank: number;
|
|
87
|
+
originalRank: number;
|
|
88
|
+
solvedProblemNum: number;
|
|
89
|
+
attemptedProblemNum: number;
|
|
90
|
+
lastSolvedProblem: Problem | null;
|
|
91
|
+
lastSolvedProblemStatistics: TeamProblemStatistics | null;
|
|
92
|
+
penalty: number;
|
|
93
|
+
problemStatistics: Array<TeamProblemStatistics>;
|
|
94
|
+
problemStatisticsMap: Map<string, TeamProblemStatistics>;
|
|
95
|
+
submissions: Submissions;
|
|
96
|
+
placeChartPoints: Array<PlaceChartPointData>;
|
|
97
|
+
awards: MedalType[];
|
|
98
|
+
badge?: Image;
|
|
99
|
+
missingPhoto: boolean;
|
|
100
|
+
photo?: Image;
|
|
101
|
+
location?: string;
|
|
102
|
+
icpcID?: string;
|
|
103
|
+
ip?: string;
|
|
104
|
+
se: number;
|
|
105
|
+
constructor();
|
|
106
|
+
reset(): void;
|
|
107
|
+
get penaltyToMinute(): number;
|
|
108
|
+
get isUnofficial(): boolean;
|
|
109
|
+
get isGirl(): boolean;
|
|
110
|
+
get isEffectiveTeam(): boolean;
|
|
111
|
+
get dirt(): number;
|
|
112
|
+
membersToString(lang?: Lang): string;
|
|
113
|
+
coachesToString(lang?: Lang): string;
|
|
114
|
+
calcSE(totalTeams: number): number;
|
|
115
|
+
calcSolvedData(options: ContestOptions): void;
|
|
116
|
+
calcAwards(awards?: Award[]): void;
|
|
117
|
+
isEqualRank(otherTeam: Team): boolean;
|
|
118
|
+
postProcessPlaceChartPoints(): void;
|
|
119
|
+
static compare(lhs: Team, rhs: Team): number;
|
|
120
|
+
}
|
|
121
|
+
type Teams = Array<Team>;
|
|
122
|
+
declare function createTeam(teamJSON: Team$1): Team;
|
|
123
|
+
declare function createTeams(teamsJSON: Teams$1): Teams;
|
|
124
|
+
|
|
125
|
+
declare class Organization {
|
|
126
|
+
id: string;
|
|
127
|
+
name: I18nText;
|
|
128
|
+
logo?: Image;
|
|
129
|
+
icpcID?: string;
|
|
130
|
+
teams: Teams;
|
|
131
|
+
rank: number;
|
|
54
132
|
constructor();
|
|
133
|
+
reset(): void;
|
|
134
|
+
static compare(lhs: Organization, rhs: Organization): number;
|
|
55
135
|
}
|
|
136
|
+
type Organizations = Array<Organization>;
|
|
137
|
+
declare function createOrganization(orgJSON: Organization$1): Organization;
|
|
138
|
+
declare function createOrganizations(orgsJSON: Organizations$1): Organizations;
|
|
56
139
|
|
|
57
140
|
declare class Group {
|
|
58
141
|
name: I18nText;
|
|
@@ -89,7 +172,6 @@ declare class Contest {
|
|
|
89
172
|
problems: Problems;
|
|
90
173
|
problemsMap: Map<string, Problem>;
|
|
91
174
|
statusTimeDisplay: StatusTimeDisplay;
|
|
92
|
-
badge?: string;
|
|
93
175
|
organization?: string;
|
|
94
176
|
medal?: Record<string, Record<string, number>> | MedalPreset;
|
|
95
177
|
awards?: Awards;
|
|
@@ -100,6 +182,7 @@ declare class Contest {
|
|
|
100
182
|
bannerMode?: BannerMode;
|
|
101
183
|
boardLink?: string;
|
|
102
184
|
options: ContestOptions;
|
|
185
|
+
organizations?: Organizations;
|
|
103
186
|
constructor();
|
|
104
187
|
getStartTime(): dayjs.Dayjs;
|
|
105
188
|
getEndTime(): dayjs.Dayjs;
|
|
@@ -200,88 +283,6 @@ declare class TeamProblemStatistics {
|
|
|
200
283
|
get penaltyInSecond(): number;
|
|
201
284
|
}
|
|
202
285
|
|
|
203
|
-
declare class Organization {
|
|
204
|
-
id: string;
|
|
205
|
-
name: I18nText;
|
|
206
|
-
logo?: Image;
|
|
207
|
-
icpcID?: string;
|
|
208
|
-
teams: Teams;
|
|
209
|
-
rank: number;
|
|
210
|
-
constructor();
|
|
211
|
-
reset(): void;
|
|
212
|
-
static compare(lhs: Organization, rhs: Organization): number;
|
|
213
|
-
}
|
|
214
|
-
type Organizations = Array<Organization>;
|
|
215
|
-
declare function createOrganization(orgJSON: Organization$1): Organization;
|
|
216
|
-
declare function createOrganizations(orgsJSON: Organizations$1): Organizations;
|
|
217
|
-
|
|
218
|
-
declare class Person {
|
|
219
|
-
name: I18nText;
|
|
220
|
-
cfID?: string;
|
|
221
|
-
icpcID?: string;
|
|
222
|
-
constructor(name?: I18nText);
|
|
223
|
-
toIPerson(): Person$1;
|
|
224
|
-
static fromIPerson(iPerson: Person$1): Person;
|
|
225
|
-
}
|
|
226
|
-
type Persons = Array<Person>;
|
|
227
|
-
declare function createPersons(iPersons?: Text | Array<Text> | Persons$1): Persons;
|
|
228
|
-
|
|
229
|
-
declare class PlaceChartPointData {
|
|
230
|
-
timePoint: number;
|
|
231
|
-
rank: number;
|
|
232
|
-
lastSolvedProblem: Problem | null;
|
|
233
|
-
constructor();
|
|
234
|
-
}
|
|
235
|
-
declare class Team {
|
|
236
|
-
id: string;
|
|
237
|
-
name: I18nText;
|
|
238
|
-
organizationId?: string;
|
|
239
|
-
organizationName?: string;
|
|
240
|
-
organization?: Organization;
|
|
241
|
-
isFirstRankOfOrganization: boolean;
|
|
242
|
-
group: Array<string>;
|
|
243
|
-
tag: Array<string>;
|
|
244
|
-
coaches: Persons;
|
|
245
|
-
members: Persons;
|
|
246
|
-
rank: number;
|
|
247
|
-
originalRank: number;
|
|
248
|
-
solvedProblemNum: number;
|
|
249
|
-
attemptedProblemNum: number;
|
|
250
|
-
lastSolvedProblem: Problem | null;
|
|
251
|
-
lastSolvedProblemStatistics: TeamProblemStatistics | null;
|
|
252
|
-
penalty: number;
|
|
253
|
-
problemStatistics: Array<TeamProblemStatistics>;
|
|
254
|
-
problemStatisticsMap: Map<string, TeamProblemStatistics>;
|
|
255
|
-
submissions: Submissions;
|
|
256
|
-
placeChartPoints: Array<PlaceChartPointData>;
|
|
257
|
-
awards: MedalType[];
|
|
258
|
-
badge?: Image;
|
|
259
|
-
missingPhoto: boolean;
|
|
260
|
-
photo?: Image;
|
|
261
|
-
location?: string;
|
|
262
|
-
icpcID?: string;
|
|
263
|
-
ip?: string;
|
|
264
|
-
se: number;
|
|
265
|
-
constructor();
|
|
266
|
-
reset(): void;
|
|
267
|
-
get penaltyToMinute(): number;
|
|
268
|
-
get isUnofficial(): boolean;
|
|
269
|
-
get isGirl(): boolean;
|
|
270
|
-
get isEffectiveTeam(): boolean;
|
|
271
|
-
get dirt(): number;
|
|
272
|
-
membersToString(lang?: Lang): string;
|
|
273
|
-
coachesToString(lang?: Lang): string;
|
|
274
|
-
calcSE(totalTeams: number): number;
|
|
275
|
-
calcSolvedData(options: ContestOptions): void;
|
|
276
|
-
calcAwards(awards?: Award[]): void;
|
|
277
|
-
isEqualRank(otherTeam: Team): boolean;
|
|
278
|
-
postProcessPlaceChartPoints(): void;
|
|
279
|
-
static compare(lhs: Team, rhs: Team): number;
|
|
280
|
-
}
|
|
281
|
-
type Teams = Array<Team>;
|
|
282
|
-
declare function createTeam(teamJSON: Team$1): Team;
|
|
283
|
-
declare function createTeams(teamsJSON: Teams$1): Teams;
|
|
284
|
-
|
|
285
286
|
declare class Balloon {
|
|
286
287
|
problem: Problem;
|
|
287
288
|
team: Team;
|
|
@@ -398,6 +399,7 @@ declare class Rank {
|
|
|
398
399
|
languages: Array<string>;
|
|
399
400
|
statuses: Array<SubmissionStatus>;
|
|
400
401
|
constructor(contest: Contest, teams: Teams, submissions: Submissions);
|
|
402
|
+
linkTeamAndOrg(): void;
|
|
401
403
|
buildOrganizationsMap(): Map<string, Organization>;
|
|
402
404
|
cleanRank(): void;
|
|
403
405
|
buildRank(): this;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CalculationOfPenalty, TimeUnit, Image, Lang, I18NStringSet, Text, Person as Person$1, Persons as Persons$1, Team as Team$1, Teams as Teams$1, Organization as Organization$1, Organizations as Organizations$1, StatusTimeDisplay, MedalPreset, BannerMode, ContestState, Contest as Contest$1, SubmissionReaction, SubmissionStatus, Submission as Submission$1, Submissions as Submissions$1, BalloonColor, Problem as Problem$1, Problems as Problems$1, ContestIndex as ContestIndex$1, IRatingHistory, IRatingUser, IRating } from '@xcpcio/types';
|
|
2
2
|
import dayjs from 'dayjs';
|
|
3
3
|
export { default as dayjs } from 'dayjs';
|
|
4
4
|
import * as XLSX from 'xlsx-js-style';
|
|
@@ -19,6 +19,23 @@ declare class Award {
|
|
|
19
19
|
declare function isValidMedalType(medal: MedalType): boolean;
|
|
20
20
|
type Awards = Map<string, Award[]>;
|
|
21
21
|
|
|
22
|
+
declare class ContestOptions {
|
|
23
|
+
enableOrganization: boolean;
|
|
24
|
+
calculationOfPenalty: CalculationOfPenalty;
|
|
25
|
+
submissionTimestampUnit: TimeUnit;
|
|
26
|
+
submissionHasTimeField: boolean;
|
|
27
|
+
submissionHasLanguageField: boolean;
|
|
28
|
+
submissionEnableActionField: boolean;
|
|
29
|
+
submissionHasReactionField: boolean;
|
|
30
|
+
submissionHasExternalUrlField: boolean;
|
|
31
|
+
reactionVideoUrlTemplate?: string;
|
|
32
|
+
submissionExternalUrlTemplate?: string;
|
|
33
|
+
teamPhotoTemplate?: Image;
|
|
34
|
+
teamWebcamStreamUrlTemplate?: string;
|
|
35
|
+
teamScreenStreamUrlTemplate?: string;
|
|
36
|
+
constructor();
|
|
37
|
+
}
|
|
38
|
+
|
|
22
39
|
interface SelectOptionItem {
|
|
23
40
|
value: string;
|
|
24
41
|
text: string;
|
|
@@ -38,21 +55,87 @@ declare class I18nText {
|
|
|
38
55
|
valueOf(): string;
|
|
39
56
|
}
|
|
40
57
|
|
|
41
|
-
declare class
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
declare class Person {
|
|
59
|
+
name: I18nText;
|
|
60
|
+
cfID?: string;
|
|
61
|
+
icpcID?: string;
|
|
62
|
+
constructor(name?: I18nText);
|
|
63
|
+
toIPerson(): Person$1;
|
|
64
|
+
static fromIPerson(iPerson: Person$1): Person;
|
|
65
|
+
}
|
|
66
|
+
type Persons = Array<Person>;
|
|
67
|
+
declare function createPersons(iPersons?: Text | Array<Text> | Persons$1): Persons;
|
|
68
|
+
|
|
69
|
+
declare class PlaceChartPointData {
|
|
70
|
+
timePoint: number;
|
|
71
|
+
rank: number;
|
|
72
|
+
lastSolvedProblem: Problem | null;
|
|
73
|
+
constructor();
|
|
74
|
+
}
|
|
75
|
+
declare class Team {
|
|
76
|
+
id: string;
|
|
77
|
+
name: I18nText;
|
|
78
|
+
organizationId?: string;
|
|
79
|
+
organizationName?: string;
|
|
80
|
+
organization?: Organization;
|
|
81
|
+
isFirstRankOfOrganization: boolean;
|
|
82
|
+
group: Array<string>;
|
|
83
|
+
tag: Array<string>;
|
|
84
|
+
coaches: Persons;
|
|
85
|
+
members: Persons;
|
|
86
|
+
rank: number;
|
|
87
|
+
originalRank: number;
|
|
88
|
+
solvedProblemNum: number;
|
|
89
|
+
attemptedProblemNum: number;
|
|
90
|
+
lastSolvedProblem: Problem | null;
|
|
91
|
+
lastSolvedProblemStatistics: TeamProblemStatistics | null;
|
|
92
|
+
penalty: number;
|
|
93
|
+
problemStatistics: Array<TeamProblemStatistics>;
|
|
94
|
+
problemStatisticsMap: Map<string, TeamProblemStatistics>;
|
|
95
|
+
submissions: Submissions;
|
|
96
|
+
placeChartPoints: Array<PlaceChartPointData>;
|
|
97
|
+
awards: MedalType[];
|
|
98
|
+
badge?: Image;
|
|
99
|
+
missingPhoto: boolean;
|
|
100
|
+
photo?: Image;
|
|
101
|
+
location?: string;
|
|
102
|
+
icpcID?: string;
|
|
103
|
+
ip?: string;
|
|
104
|
+
se: number;
|
|
105
|
+
constructor();
|
|
106
|
+
reset(): void;
|
|
107
|
+
get penaltyToMinute(): number;
|
|
108
|
+
get isUnofficial(): boolean;
|
|
109
|
+
get isGirl(): boolean;
|
|
110
|
+
get isEffectiveTeam(): boolean;
|
|
111
|
+
get dirt(): number;
|
|
112
|
+
membersToString(lang?: Lang): string;
|
|
113
|
+
coachesToString(lang?: Lang): string;
|
|
114
|
+
calcSE(totalTeams: number): number;
|
|
115
|
+
calcSolvedData(options: ContestOptions): void;
|
|
116
|
+
calcAwards(awards?: Award[]): void;
|
|
117
|
+
isEqualRank(otherTeam: Team): boolean;
|
|
118
|
+
postProcessPlaceChartPoints(): void;
|
|
119
|
+
static compare(lhs: Team, rhs: Team): number;
|
|
120
|
+
}
|
|
121
|
+
type Teams = Array<Team>;
|
|
122
|
+
declare function createTeam(teamJSON: Team$1): Team;
|
|
123
|
+
declare function createTeams(teamsJSON: Teams$1): Teams;
|
|
124
|
+
|
|
125
|
+
declare class Organization {
|
|
126
|
+
id: string;
|
|
127
|
+
name: I18nText;
|
|
128
|
+
logo?: Image;
|
|
129
|
+
icpcID?: string;
|
|
130
|
+
teams: Teams;
|
|
131
|
+
rank: number;
|
|
54
132
|
constructor();
|
|
133
|
+
reset(): void;
|
|
134
|
+
static compare(lhs: Organization, rhs: Organization): number;
|
|
55
135
|
}
|
|
136
|
+
type Organizations = Array<Organization>;
|
|
137
|
+
declare function createOrganization(orgJSON: Organization$1): Organization;
|
|
138
|
+
declare function createOrganizations(orgsJSON: Organizations$1): Organizations;
|
|
56
139
|
|
|
57
140
|
declare class Group {
|
|
58
141
|
name: I18nText;
|
|
@@ -89,7 +172,6 @@ declare class Contest {
|
|
|
89
172
|
problems: Problems;
|
|
90
173
|
problemsMap: Map<string, Problem>;
|
|
91
174
|
statusTimeDisplay: StatusTimeDisplay;
|
|
92
|
-
badge?: string;
|
|
93
175
|
organization?: string;
|
|
94
176
|
medal?: Record<string, Record<string, number>> | MedalPreset;
|
|
95
177
|
awards?: Awards;
|
|
@@ -100,6 +182,7 @@ declare class Contest {
|
|
|
100
182
|
bannerMode?: BannerMode;
|
|
101
183
|
boardLink?: string;
|
|
102
184
|
options: ContestOptions;
|
|
185
|
+
organizations?: Organizations;
|
|
103
186
|
constructor();
|
|
104
187
|
getStartTime(): dayjs.Dayjs;
|
|
105
188
|
getEndTime(): dayjs.Dayjs;
|
|
@@ -200,88 +283,6 @@ declare class TeamProblemStatistics {
|
|
|
200
283
|
get penaltyInSecond(): number;
|
|
201
284
|
}
|
|
202
285
|
|
|
203
|
-
declare class Organization {
|
|
204
|
-
id: string;
|
|
205
|
-
name: I18nText;
|
|
206
|
-
logo?: Image;
|
|
207
|
-
icpcID?: string;
|
|
208
|
-
teams: Teams;
|
|
209
|
-
rank: number;
|
|
210
|
-
constructor();
|
|
211
|
-
reset(): void;
|
|
212
|
-
static compare(lhs: Organization, rhs: Organization): number;
|
|
213
|
-
}
|
|
214
|
-
type Organizations = Array<Organization>;
|
|
215
|
-
declare function createOrganization(orgJSON: Organization$1): Organization;
|
|
216
|
-
declare function createOrganizations(orgsJSON: Organizations$1): Organizations;
|
|
217
|
-
|
|
218
|
-
declare class Person {
|
|
219
|
-
name: I18nText;
|
|
220
|
-
cfID?: string;
|
|
221
|
-
icpcID?: string;
|
|
222
|
-
constructor(name?: I18nText);
|
|
223
|
-
toIPerson(): Person$1;
|
|
224
|
-
static fromIPerson(iPerson: Person$1): Person;
|
|
225
|
-
}
|
|
226
|
-
type Persons = Array<Person>;
|
|
227
|
-
declare function createPersons(iPersons?: Text | Array<Text> | Persons$1): Persons;
|
|
228
|
-
|
|
229
|
-
declare class PlaceChartPointData {
|
|
230
|
-
timePoint: number;
|
|
231
|
-
rank: number;
|
|
232
|
-
lastSolvedProblem: Problem | null;
|
|
233
|
-
constructor();
|
|
234
|
-
}
|
|
235
|
-
declare class Team {
|
|
236
|
-
id: string;
|
|
237
|
-
name: I18nText;
|
|
238
|
-
organizationId?: string;
|
|
239
|
-
organizationName?: string;
|
|
240
|
-
organization?: Organization;
|
|
241
|
-
isFirstRankOfOrganization: boolean;
|
|
242
|
-
group: Array<string>;
|
|
243
|
-
tag: Array<string>;
|
|
244
|
-
coaches: Persons;
|
|
245
|
-
members: Persons;
|
|
246
|
-
rank: number;
|
|
247
|
-
originalRank: number;
|
|
248
|
-
solvedProblemNum: number;
|
|
249
|
-
attemptedProblemNum: number;
|
|
250
|
-
lastSolvedProblem: Problem | null;
|
|
251
|
-
lastSolvedProblemStatistics: TeamProblemStatistics | null;
|
|
252
|
-
penalty: number;
|
|
253
|
-
problemStatistics: Array<TeamProblemStatistics>;
|
|
254
|
-
problemStatisticsMap: Map<string, TeamProblemStatistics>;
|
|
255
|
-
submissions: Submissions;
|
|
256
|
-
placeChartPoints: Array<PlaceChartPointData>;
|
|
257
|
-
awards: MedalType[];
|
|
258
|
-
badge?: Image;
|
|
259
|
-
missingPhoto: boolean;
|
|
260
|
-
photo?: Image;
|
|
261
|
-
location?: string;
|
|
262
|
-
icpcID?: string;
|
|
263
|
-
ip?: string;
|
|
264
|
-
se: number;
|
|
265
|
-
constructor();
|
|
266
|
-
reset(): void;
|
|
267
|
-
get penaltyToMinute(): number;
|
|
268
|
-
get isUnofficial(): boolean;
|
|
269
|
-
get isGirl(): boolean;
|
|
270
|
-
get isEffectiveTeam(): boolean;
|
|
271
|
-
get dirt(): number;
|
|
272
|
-
membersToString(lang?: Lang): string;
|
|
273
|
-
coachesToString(lang?: Lang): string;
|
|
274
|
-
calcSE(totalTeams: number): number;
|
|
275
|
-
calcSolvedData(options: ContestOptions): void;
|
|
276
|
-
calcAwards(awards?: Award[]): void;
|
|
277
|
-
isEqualRank(otherTeam: Team): boolean;
|
|
278
|
-
postProcessPlaceChartPoints(): void;
|
|
279
|
-
static compare(lhs: Team, rhs: Team): number;
|
|
280
|
-
}
|
|
281
|
-
type Teams = Array<Team>;
|
|
282
|
-
declare function createTeam(teamJSON: Team$1): Team;
|
|
283
|
-
declare function createTeams(teamsJSON: Teams$1): Teams;
|
|
284
|
-
|
|
285
286
|
declare class Balloon {
|
|
286
287
|
problem: Problem;
|
|
287
288
|
team: Team;
|
|
@@ -398,6 +399,7 @@ declare class Rank {
|
|
|
398
399
|
languages: Array<string>;
|
|
399
400
|
statuses: Array<SubmissionStatus>;
|
|
400
401
|
constructor(contest: Contest, teams: Teams, submissions: Submissions);
|
|
402
|
+
linkTeamAndOrg(): void;
|
|
401
403
|
buildOrganizationsMap(): Map<string, Organization>;
|
|
402
404
|
cleanRank(): void;
|
|
403
405
|
buildRank(): this;
|
package/dist/index.mjs
CHANGED
|
@@ -1022,6 +1022,7 @@ class BattleOfGiants {
|
|
|
1022
1022
|
}
|
|
1023
1023
|
|
|
1024
1024
|
class ContestOptions {
|
|
1025
|
+
enableOrganization;
|
|
1025
1026
|
calculationOfPenalty;
|
|
1026
1027
|
submissionTimestampUnit;
|
|
1027
1028
|
submissionHasTimeField;
|
|
@@ -1035,6 +1036,7 @@ class ContestOptions {
|
|
|
1035
1036
|
teamWebcamStreamUrlTemplate;
|
|
1036
1037
|
teamScreenStreamUrlTemplate;
|
|
1037
1038
|
constructor() {
|
|
1039
|
+
this.enableOrganization = false;
|
|
1038
1040
|
this.calculationOfPenalty = "in_minutes";
|
|
1039
1041
|
this.submissionTimestampUnit = "second";
|
|
1040
1042
|
this.submissionHasTimeField = false;
|
|
@@ -1047,6 +1049,7 @@ class ContestOptions {
|
|
|
1047
1049
|
function createContestOptions(contestOptionsJSON = {}) {
|
|
1048
1050
|
const j = contestOptionsJSON;
|
|
1049
1051
|
const o = new ContestOptions();
|
|
1052
|
+
o.enableOrganization = !!j.enable_organization;
|
|
1050
1053
|
if (j.calculation_of_penalty) {
|
|
1051
1054
|
o.calculationOfPenalty = j.calculation_of_penalty;
|
|
1052
1055
|
}
|
|
@@ -1077,6 +1080,44 @@ class Group {
|
|
|
1077
1080
|
}
|
|
1078
1081
|
}
|
|
1079
1082
|
|
|
1083
|
+
class Organization {
|
|
1084
|
+
id;
|
|
1085
|
+
name;
|
|
1086
|
+
logo;
|
|
1087
|
+
icpcID;
|
|
1088
|
+
// Teams belonging to this organization
|
|
1089
|
+
teams;
|
|
1090
|
+
rank;
|
|
1091
|
+
constructor() {
|
|
1092
|
+
this.id = "";
|
|
1093
|
+
this.name = new I18nText();
|
|
1094
|
+
this.teams = [];
|
|
1095
|
+
this.rank = -1;
|
|
1096
|
+
}
|
|
1097
|
+
reset() {
|
|
1098
|
+
this.rank = -1;
|
|
1099
|
+
}
|
|
1100
|
+
static compare(lhs, rhs) {
|
|
1101
|
+
if (lhs.id < rhs.id) {
|
|
1102
|
+
return -1;
|
|
1103
|
+
} else if (lhs.id > rhs.id) {
|
|
1104
|
+
return 1;
|
|
1105
|
+
}
|
|
1106
|
+
return 0;
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
function createOrganization(orgJSON) {
|
|
1110
|
+
const org = new Organization();
|
|
1111
|
+
org.id = orgJSON.id;
|
|
1112
|
+
org.name = I18nText.fromIText(orgJSON.name);
|
|
1113
|
+
org.logo = orgJSON.logo;
|
|
1114
|
+
org.icpcID = orgJSON.icpc_id;
|
|
1115
|
+
return org;
|
|
1116
|
+
}
|
|
1117
|
+
function createOrganizations(orgsJSON) {
|
|
1118
|
+
return orgsJSON.map((org) => createOrganization(org));
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1080
1121
|
class Contest {
|
|
1081
1122
|
id = "";
|
|
1082
1123
|
name;
|
|
@@ -1095,7 +1136,6 @@ class Contest {
|
|
|
1095
1136
|
problems;
|
|
1096
1137
|
problemsMap;
|
|
1097
1138
|
statusTimeDisplay;
|
|
1098
|
-
badge;
|
|
1099
1139
|
organization;
|
|
1100
1140
|
medal;
|
|
1101
1141
|
awards;
|
|
@@ -1106,6 +1146,7 @@ class Contest {
|
|
|
1106
1146
|
bannerMode;
|
|
1107
1147
|
boardLink;
|
|
1108
1148
|
options;
|
|
1149
|
+
organizations;
|
|
1109
1150
|
constructor() {
|
|
1110
1151
|
this.name = new I18nText();
|
|
1111
1152
|
this.startTime = createDayJS();
|
|
@@ -1257,7 +1298,6 @@ function createContest(contestJSON) {
|
|
|
1257
1298
|
pending: Boolean(contestJSON.status_time_display.pending ?? false)
|
|
1258
1299
|
};
|
|
1259
1300
|
}
|
|
1260
|
-
c.badge = contestJSON.badge;
|
|
1261
1301
|
c.organization = contestJSON.organization;
|
|
1262
1302
|
c.medal = contestJSON.medal;
|
|
1263
1303
|
(() => {
|
|
@@ -1330,6 +1370,12 @@ function createContest(contestJSON) {
|
|
|
1330
1370
|
if (contestJSON.options) {
|
|
1331
1371
|
c.options = createContestOptions(contestJSON.options);
|
|
1332
1372
|
}
|
|
1373
|
+
if (c.organization) {
|
|
1374
|
+
c.options.enableOrganization = true;
|
|
1375
|
+
}
|
|
1376
|
+
if (contestJSON.organizations) {
|
|
1377
|
+
c.organizations = createOrganizations(contestJSON.organizations);
|
|
1378
|
+
}
|
|
1333
1379
|
return c;
|
|
1334
1380
|
}
|
|
1335
1381
|
|
|
@@ -1607,9 +1653,9 @@ class GeneralExcelConverter {
|
|
|
1607
1653
|
{
|
|
1608
1654
|
const head = [];
|
|
1609
1655
|
head.push("Rank");
|
|
1610
|
-
if (rank.contest.
|
|
1611
|
-
head.push(
|
|
1612
|
-
head.push(
|
|
1656
|
+
if (rank.contest.options.enableOrganization) {
|
|
1657
|
+
head.push("Organization Rank");
|
|
1658
|
+
head.push("Organization");
|
|
1613
1659
|
}
|
|
1614
1660
|
head.push("Team", "Solved", "Penalty", ...rank.contest.problems.map((p) => p.label), "Dirt");
|
|
1615
1661
|
if (enableAwards) {
|
|
@@ -1750,49 +1796,14 @@ function getImageSource(image, data_host) {
|
|
|
1750
1796
|
return `${normalizePath(data_host)}${image.url}`;
|
|
1751
1797
|
}
|
|
1752
1798
|
if (image?.base64) {
|
|
1799
|
+
if (image.mime) {
|
|
1800
|
+
return `data:${image.mime};base64,${image.base64}`;
|
|
1801
|
+
}
|
|
1753
1802
|
return `data:image/${image.type ?? "png"};base64,${image.base64}`;
|
|
1754
1803
|
}
|
|
1755
1804
|
return "";
|
|
1756
1805
|
}
|
|
1757
1806
|
|
|
1758
|
-
class Organization {
|
|
1759
|
-
id;
|
|
1760
|
-
name;
|
|
1761
|
-
logo;
|
|
1762
|
-
icpcID;
|
|
1763
|
-
// Teams belonging to this organization
|
|
1764
|
-
teams;
|
|
1765
|
-
rank;
|
|
1766
|
-
constructor() {
|
|
1767
|
-
this.id = "";
|
|
1768
|
-
this.name = new I18nText();
|
|
1769
|
-
this.teams = [];
|
|
1770
|
-
this.rank = -1;
|
|
1771
|
-
}
|
|
1772
|
-
reset() {
|
|
1773
|
-
this.rank = -1;
|
|
1774
|
-
}
|
|
1775
|
-
static compare(lhs, rhs) {
|
|
1776
|
-
if (lhs.id < rhs.id) {
|
|
1777
|
-
return -1;
|
|
1778
|
-
} else if (lhs.id > rhs.id) {
|
|
1779
|
-
return 1;
|
|
1780
|
-
}
|
|
1781
|
-
return 0;
|
|
1782
|
-
}
|
|
1783
|
-
}
|
|
1784
|
-
function createOrganization(orgJSON) {
|
|
1785
|
-
const org = new Organization();
|
|
1786
|
-
org.id = orgJSON.id;
|
|
1787
|
-
org.name = I18nText.fromIText(orgJSON.name);
|
|
1788
|
-
org.logo = orgJSON.logo;
|
|
1789
|
-
org.icpcID = orgJSON.icpc_id;
|
|
1790
|
-
return org;
|
|
1791
|
-
}
|
|
1792
|
-
function createOrganizations(orgsJSON) {
|
|
1793
|
-
return orgsJSON.map((org) => createOrganization(org));
|
|
1794
|
-
}
|
|
1795
|
-
|
|
1796
1807
|
class RankStatistics {
|
|
1797
1808
|
teamSolvedNum;
|
|
1798
1809
|
teamSolvedNumIndex;
|
|
@@ -1943,8 +1954,16 @@ class Rank {
|
|
|
1943
1954
|
});
|
|
1944
1955
|
}
|
|
1945
1956
|
this.submissionsMap = new Map(this.submissions.map((s) => [s.id, s]));
|
|
1946
|
-
|
|
1947
|
-
|
|
1957
|
+
if (this.contest.organizations) {
|
|
1958
|
+
this.organizations = this.contest.organizations;
|
|
1959
|
+
this.organizationsMap = new Map(
|
|
1960
|
+
this.organizations.map((org) => [org.id, org])
|
|
1961
|
+
);
|
|
1962
|
+
this.linkTeamAndOrg();
|
|
1963
|
+
} else {
|
|
1964
|
+
this.organizationsMap = this.buildOrganizationsMap();
|
|
1965
|
+
this.organizations = [...this.organizationsMap.values()];
|
|
1966
|
+
}
|
|
1948
1967
|
this.organizations.sort(Organization.compare);
|
|
1949
1968
|
this.originTeams = this.teams.map((t) => t);
|
|
1950
1969
|
this.originTeams.sort(Team.compare);
|
|
@@ -1968,8 +1987,16 @@ class Rank {
|
|
|
1968
1987
|
this.statuses = [...se].sort();
|
|
1969
1988
|
}
|
|
1970
1989
|
}
|
|
1990
|
+
linkTeamAndOrg() {
|
|
1991
|
+
this.teams.forEach((t) => {
|
|
1992
|
+
if (!t.organizationId) {
|
|
1993
|
+
return;
|
|
1994
|
+
}
|
|
1995
|
+
t.organization = this.organizationsMap.get(t.organizationId);
|
|
1996
|
+
});
|
|
1997
|
+
}
|
|
1971
1998
|
buildOrganizationsMap() {
|
|
1972
|
-
if (!this.contest.
|
|
1999
|
+
if (!this.contest.options.enableOrganization) {
|
|
1973
2000
|
return /* @__PURE__ */ new Map();
|
|
1974
2001
|
}
|
|
1975
2002
|
const res = /* @__PURE__ */ new Map();
|
|
@@ -2155,7 +2182,7 @@ class Rank {
|
|
|
2155
2182
|
}
|
|
2156
2183
|
}
|
|
2157
2184
|
buildOrgRank() {
|
|
2158
|
-
if (!this.contest.
|
|
2185
|
+
if (!this.contest.options.enableOrganization) {
|
|
2159
2186
|
return;
|
|
2160
2187
|
}
|
|
2161
2188
|
let rank = 1;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xcpcio/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.79.1",
|
|
5
5
|
"description": "The core library for XCPCIO",
|
|
6
6
|
"author": "Dup4 <hi@dup4.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"papaparse": "^5.5.3",
|
|
43
43
|
"string-width": "^8.1.0",
|
|
44
44
|
"xlsx-js-style": "^1.2.0",
|
|
45
|
-
"@xcpcio/types": "0.
|
|
45
|
+
"@xcpcio/types": "0.79.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@babel/types": "^7.28.6",
|