@xcpcio/core 0.51.1 → 0.52.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 +124 -0
- package/dist/index.d.ts +22 -1
- package/dist/index.mjs +124 -1
- package/package.json +4 -4
- package/src/index.ts +1 -0
- package/src/resolver-vue.ts +182 -0
package/dist/index.cjs
CHANGED
|
@@ -2411,6 +2411,129 @@ class Resolver extends Rank {
|
|
|
2411
2411
|
}
|
|
2412
2412
|
}
|
|
2413
2413
|
|
|
2414
|
+
class ResolverVue extends Resolver {
|
|
2415
|
+
constructor(contest, teams, submissions) {
|
|
2416
|
+
super(contest, teams, submissions);
|
|
2417
|
+
this.FLASHING_TIME_MS = 100;
|
|
2418
|
+
this.ROLLING_TIME_MS = 600;
|
|
2419
|
+
this.maxIndex = 0;
|
|
2420
|
+
this.currentIndex = 0;
|
|
2421
|
+
this.maxOpIndex = 0;
|
|
2422
|
+
this.currentOpIndex = 0;
|
|
2423
|
+
this.oldRank = -1;
|
|
2424
|
+
this.newRank = -1;
|
|
2425
|
+
this.currentTeamId = "";
|
|
2426
|
+
this.currentProblemIndex = -1;
|
|
2427
|
+
this.problemFlashingEnded = true;
|
|
2428
|
+
this.duringAnimation = false;
|
|
2429
|
+
this.startScrollUp = false;
|
|
2430
|
+
this.startScrollDown = false;
|
|
2431
|
+
}
|
|
2432
|
+
buildResolver() {
|
|
2433
|
+
super.buildResolver();
|
|
2434
|
+
this.maxIndex = this.teams.length - 1;
|
|
2435
|
+
this.currentIndex = this.maxIndex;
|
|
2436
|
+
this.maxOpIndex = this.operations.length - 1;
|
|
2437
|
+
this.currentOpIndex = 0;
|
|
2438
|
+
this.oldRank = -1;
|
|
2439
|
+
this.newRank = -1;
|
|
2440
|
+
this.currentTeamId = "";
|
|
2441
|
+
this.currentProblemIndex = -1;
|
|
2442
|
+
this.problemFlashingEnded = true;
|
|
2443
|
+
this.duringAnimation = false;
|
|
2444
|
+
this.startScrollUp = false;
|
|
2445
|
+
this.startScrollDown = false;
|
|
2446
|
+
}
|
|
2447
|
+
next() {
|
|
2448
|
+
if (this.duringAnimation) {
|
|
2449
|
+
return;
|
|
2450
|
+
}
|
|
2451
|
+
if (this.currentOpIndex > this.maxOpIndex) {
|
|
2452
|
+
if (this.currentIndex > 0) {
|
|
2453
|
+
this.currentIndex--;
|
|
2454
|
+
}
|
|
2455
|
+
return;
|
|
2456
|
+
}
|
|
2457
|
+
const op = this.operations[this.currentOpIndex];
|
|
2458
|
+
const pIx = op.problemIx;
|
|
2459
|
+
const teamId = op.team.id;
|
|
2460
|
+
const team = this.teamsMap.get(teamId);
|
|
2461
|
+
const currentRank = team.rank;
|
|
2462
|
+
if (this.currentIndex + 1 > currentRank) {
|
|
2463
|
+
this.currentIndex--;
|
|
2464
|
+
return;
|
|
2465
|
+
}
|
|
2466
|
+
if (this.currentIndex + 1 !== currentRank) {
|
|
2467
|
+
return;
|
|
2468
|
+
}
|
|
2469
|
+
team.problemStatistics[pIx] = op.afterTeamProblemStatistics;
|
|
2470
|
+
team.calcSolvedData(this.contest.options);
|
|
2471
|
+
this.currentProblemIndex = pIx;
|
|
2472
|
+
this.currentTeamId = teamId;
|
|
2473
|
+
{
|
|
2474
|
+
this.oldRank = team.rank;
|
|
2475
|
+
this.newRank = this.oldRank;
|
|
2476
|
+
for (let j = this.currentIndex - 1; j >= 0; j--) {
|
|
2477
|
+
if (Team.compare(team, this.teams[j]) < 0) {
|
|
2478
|
+
this.newRank = this.teams[j].rank;
|
|
2479
|
+
} else {
|
|
2480
|
+
break;
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
this.currentOpIndex++;
|
|
2485
|
+
{
|
|
2486
|
+
let j = this.oldRank - 1;
|
|
2487
|
+
while (j >= 0 && Team.compare(this.teams[j], this.teams[j - 1]) < 0) {
|
|
2488
|
+
[this.teams[j], this.teams[j - 1]] = [this.teams[j - 1], this.teams[j]];
|
|
2489
|
+
this.teams[j].rank = j + 1;
|
|
2490
|
+
this.teams[j - 1].rank = j;
|
|
2491
|
+
j--;
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2495
|
+
rewind() {
|
|
2496
|
+
if (this.duringAnimation) {
|
|
2497
|
+
return;
|
|
2498
|
+
}
|
|
2499
|
+
if (this.currentOpIndex < 1) {
|
|
2500
|
+
return;
|
|
2501
|
+
}
|
|
2502
|
+
this.currentOpIndex--;
|
|
2503
|
+
const op = this.operations[this.currentOpIndex];
|
|
2504
|
+
const pIx = op.problemIx;
|
|
2505
|
+
const teamId = op.team.id;
|
|
2506
|
+
const team = this.teamsMap.get(teamId);
|
|
2507
|
+
team.problemStatistics[pIx] = op.beforeTeamProblemStatistics;
|
|
2508
|
+
team.calcSolvedData(this.contest.options);
|
|
2509
|
+
this.currentProblemIndex = pIx;
|
|
2510
|
+
this.currentTeamId = teamId;
|
|
2511
|
+
{
|
|
2512
|
+
this.oldRank = team.rank;
|
|
2513
|
+
this.newRank = this.oldRank;
|
|
2514
|
+
for (let j = this.currentIndex + 1; j <= this.maxIndex; j++) {
|
|
2515
|
+
if (Team.compare(team, this.teams[j]) > 0) {
|
|
2516
|
+
this.newRank = this.teams[j].rank;
|
|
2517
|
+
} else {
|
|
2518
|
+
break;
|
|
2519
|
+
}
|
|
2520
|
+
}
|
|
2521
|
+
}
|
|
2522
|
+
{
|
|
2523
|
+
let j = this.oldRank - 1;
|
|
2524
|
+
let newIndex = j;
|
|
2525
|
+
while (j < this.maxIndex && Team.compare(this.teams[j], this.teams[j + 1]) > 0) {
|
|
2526
|
+
[this.teams[j], this.teams[j + 1]] = [this.teams[j + 1], this.teams[j]];
|
|
2527
|
+
this.teams[j].rank = j + 1;
|
|
2528
|
+
this.teams[j + 1].rank = j + 2;
|
|
2529
|
+
newIndex = j + 1;
|
|
2530
|
+
j++;
|
|
2531
|
+
}
|
|
2532
|
+
this.currentIndex = newIndex;
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
}
|
|
2536
|
+
|
|
2414
2537
|
exports.dayjs = dayjs__default;
|
|
2415
2538
|
exports.Award = Award;
|
|
2416
2539
|
exports.Balloon = Balloon;
|
|
@@ -2440,6 +2563,7 @@ exports.RatingLevelToString = RatingLevelToString;
|
|
|
2440
2563
|
exports.RatingUser = RatingUser;
|
|
2441
2564
|
exports.RatingUtility = RatingUtility;
|
|
2442
2565
|
exports.Resolver = Resolver;
|
|
2566
|
+
exports.ResolverVue = ResolverVue;
|
|
2443
2567
|
exports.Submission = Submission;
|
|
2444
2568
|
exports.Team = Team;
|
|
2445
2569
|
exports.TeamProblemStatistics = TeamProblemStatistics;
|
package/dist/index.d.ts
CHANGED
|
@@ -489,10 +489,31 @@ declare class Resolver extends Rank {
|
|
|
489
489
|
buildResolver(): void;
|
|
490
490
|
}
|
|
491
491
|
|
|
492
|
+
declare class ResolverVue extends Resolver {
|
|
493
|
+
readonly FLASHING_TIME_MS = 100;
|
|
494
|
+
readonly ROLLING_TIME_MS = 600;
|
|
495
|
+
maxIndex: number;
|
|
496
|
+
currentIndex: number;
|
|
497
|
+
maxOpIndex: number;
|
|
498
|
+
currentOpIndex: number;
|
|
499
|
+
oldRank: number;
|
|
500
|
+
newRank: number;
|
|
501
|
+
currentTeamId: string;
|
|
502
|
+
currentProblemIndex: number;
|
|
503
|
+
problemFlashingEnded: boolean;
|
|
504
|
+
duringAnimation: boolean;
|
|
505
|
+
startScrollUp: boolean;
|
|
506
|
+
startScrollDown: boolean;
|
|
507
|
+
constructor(contest: Contest, teams: Teams, submissions: Submissions);
|
|
508
|
+
buildResolver(): void;
|
|
509
|
+
next(): void;
|
|
510
|
+
rewind(): void;
|
|
511
|
+
}
|
|
512
|
+
|
|
492
513
|
declare function stringToSubmissionStatus(status: string): SubmissionStatus;
|
|
493
514
|
declare function isAccepted(status: SubmissionStatus): boolean;
|
|
494
515
|
declare function isRejected(status: SubmissionStatus): boolean;
|
|
495
516
|
declare function isPending(status: SubmissionStatus): boolean;
|
|
496
517
|
declare function isNotCalculatedPenaltyStatus(status: SubmissionStatus): boolean;
|
|
497
518
|
|
|
498
|
-
export { Award, Awards, Balloon, Balloons, BattleOfGiants, CodeforcesGymGhostDATConverter, Contest, ContestIndex, ContestIndexConfig, ContestIndexList, ContestOptions, GeneralExcelConverter, Giants, GiantsType, ICPCStandingsCsvConverter, MedalType, Person, Persons, PlaceChartPointData, Problem, ProblemStatistics, Problems, Rank, RankOptions, RankStatistics, Ranks, Rating, RatingCalculator, RatingHistories, RatingHistory, RatingLevel, RatingLevelToString, RatingUser, RatingUserMap, RatingUsers, RatingUtility, Resolver, SelectOptionItem, Submission, Submissions, Team, TeamProblemStatistics, Teams, calcDirt, createContest, createContestIndex, createContestIndexList, createDayJS, createPersons, createProblem, createProblems, createProblemsByProblemIds, createSubmission, createSubmissions, createTeam, createTeams, getImageSource, getTimeDiff, getTimestamp, getWhiteOrBlackColor, getWhiteOrBlackColorV1, isAccepted, isNotCalculatedPenaltyStatus, isPending, isRejected, isValidMedalType, stringToSubmissionStatus };
|
|
519
|
+
export { Award, Awards, Balloon, Balloons, BattleOfGiants, CodeforcesGymGhostDATConverter, Contest, ContestIndex, ContestIndexConfig, ContestIndexList, ContestOptions, GeneralExcelConverter, Giants, GiantsType, ICPCStandingsCsvConverter, MedalType, Person, Persons, PlaceChartPointData, Problem, ProblemStatistics, Problems, Rank, RankOptions, RankStatistics, Ranks, Rating, RatingCalculator, RatingHistories, RatingHistory, RatingLevel, RatingLevelToString, RatingUser, RatingUserMap, RatingUsers, RatingUtility, Resolver, ResolverVue, SelectOptionItem, Submission, Submissions, Team, TeamProblemStatistics, Teams, calcDirt, createContest, createContestIndex, createContestIndexList, createDayJS, createPersons, createProblem, createProblems, createProblemsByProblemIds, createSubmission, createSubmissions, createTeam, createTeams, getImageSource, getTimeDiff, getTimestamp, getWhiteOrBlackColor, getWhiteOrBlackColorV1, isAccepted, isNotCalculatedPenaltyStatus, isPending, isRejected, isValidMedalType, stringToSubmissionStatus };
|
package/dist/index.mjs
CHANGED
|
@@ -2378,4 +2378,127 @@ class Resolver extends Rank {
|
|
|
2378
2378
|
}
|
|
2379
2379
|
}
|
|
2380
2380
|
|
|
2381
|
-
|
|
2381
|
+
class ResolverVue extends Resolver {
|
|
2382
|
+
constructor(contest, teams, submissions) {
|
|
2383
|
+
super(contest, teams, submissions);
|
|
2384
|
+
this.FLASHING_TIME_MS = 100;
|
|
2385
|
+
this.ROLLING_TIME_MS = 600;
|
|
2386
|
+
this.maxIndex = 0;
|
|
2387
|
+
this.currentIndex = 0;
|
|
2388
|
+
this.maxOpIndex = 0;
|
|
2389
|
+
this.currentOpIndex = 0;
|
|
2390
|
+
this.oldRank = -1;
|
|
2391
|
+
this.newRank = -1;
|
|
2392
|
+
this.currentTeamId = "";
|
|
2393
|
+
this.currentProblemIndex = -1;
|
|
2394
|
+
this.problemFlashingEnded = true;
|
|
2395
|
+
this.duringAnimation = false;
|
|
2396
|
+
this.startScrollUp = false;
|
|
2397
|
+
this.startScrollDown = false;
|
|
2398
|
+
}
|
|
2399
|
+
buildResolver() {
|
|
2400
|
+
super.buildResolver();
|
|
2401
|
+
this.maxIndex = this.teams.length - 1;
|
|
2402
|
+
this.currentIndex = this.maxIndex;
|
|
2403
|
+
this.maxOpIndex = this.operations.length - 1;
|
|
2404
|
+
this.currentOpIndex = 0;
|
|
2405
|
+
this.oldRank = -1;
|
|
2406
|
+
this.newRank = -1;
|
|
2407
|
+
this.currentTeamId = "";
|
|
2408
|
+
this.currentProblemIndex = -1;
|
|
2409
|
+
this.problemFlashingEnded = true;
|
|
2410
|
+
this.duringAnimation = false;
|
|
2411
|
+
this.startScrollUp = false;
|
|
2412
|
+
this.startScrollDown = false;
|
|
2413
|
+
}
|
|
2414
|
+
next() {
|
|
2415
|
+
if (this.duringAnimation) {
|
|
2416
|
+
return;
|
|
2417
|
+
}
|
|
2418
|
+
if (this.currentOpIndex > this.maxOpIndex) {
|
|
2419
|
+
if (this.currentIndex > 0) {
|
|
2420
|
+
this.currentIndex--;
|
|
2421
|
+
}
|
|
2422
|
+
return;
|
|
2423
|
+
}
|
|
2424
|
+
const op = this.operations[this.currentOpIndex];
|
|
2425
|
+
const pIx = op.problemIx;
|
|
2426
|
+
const teamId = op.team.id;
|
|
2427
|
+
const team = this.teamsMap.get(teamId);
|
|
2428
|
+
const currentRank = team.rank;
|
|
2429
|
+
if (this.currentIndex + 1 > currentRank) {
|
|
2430
|
+
this.currentIndex--;
|
|
2431
|
+
return;
|
|
2432
|
+
}
|
|
2433
|
+
if (this.currentIndex + 1 !== currentRank) {
|
|
2434
|
+
return;
|
|
2435
|
+
}
|
|
2436
|
+
team.problemStatistics[pIx] = op.afterTeamProblemStatistics;
|
|
2437
|
+
team.calcSolvedData(this.contest.options);
|
|
2438
|
+
this.currentProblemIndex = pIx;
|
|
2439
|
+
this.currentTeamId = teamId;
|
|
2440
|
+
{
|
|
2441
|
+
this.oldRank = team.rank;
|
|
2442
|
+
this.newRank = this.oldRank;
|
|
2443
|
+
for (let j = this.currentIndex - 1; j >= 0; j--) {
|
|
2444
|
+
if (Team.compare(team, this.teams[j]) < 0) {
|
|
2445
|
+
this.newRank = this.teams[j].rank;
|
|
2446
|
+
} else {
|
|
2447
|
+
break;
|
|
2448
|
+
}
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
this.currentOpIndex++;
|
|
2452
|
+
{
|
|
2453
|
+
let j = this.oldRank - 1;
|
|
2454
|
+
while (j >= 0 && Team.compare(this.teams[j], this.teams[j - 1]) < 0) {
|
|
2455
|
+
[this.teams[j], this.teams[j - 1]] = [this.teams[j - 1], this.teams[j]];
|
|
2456
|
+
this.teams[j].rank = j + 1;
|
|
2457
|
+
this.teams[j - 1].rank = j;
|
|
2458
|
+
j--;
|
|
2459
|
+
}
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2462
|
+
rewind() {
|
|
2463
|
+
if (this.duringAnimation) {
|
|
2464
|
+
return;
|
|
2465
|
+
}
|
|
2466
|
+
if (this.currentOpIndex < 1) {
|
|
2467
|
+
return;
|
|
2468
|
+
}
|
|
2469
|
+
this.currentOpIndex--;
|
|
2470
|
+
const op = this.operations[this.currentOpIndex];
|
|
2471
|
+
const pIx = op.problemIx;
|
|
2472
|
+
const teamId = op.team.id;
|
|
2473
|
+
const team = this.teamsMap.get(teamId);
|
|
2474
|
+
team.problemStatistics[pIx] = op.beforeTeamProblemStatistics;
|
|
2475
|
+
team.calcSolvedData(this.contest.options);
|
|
2476
|
+
this.currentProblemIndex = pIx;
|
|
2477
|
+
this.currentTeamId = teamId;
|
|
2478
|
+
{
|
|
2479
|
+
this.oldRank = team.rank;
|
|
2480
|
+
this.newRank = this.oldRank;
|
|
2481
|
+
for (let j = this.currentIndex + 1; j <= this.maxIndex; j++) {
|
|
2482
|
+
if (Team.compare(team, this.teams[j]) > 0) {
|
|
2483
|
+
this.newRank = this.teams[j].rank;
|
|
2484
|
+
} else {
|
|
2485
|
+
break;
|
|
2486
|
+
}
|
|
2487
|
+
}
|
|
2488
|
+
}
|
|
2489
|
+
{
|
|
2490
|
+
let j = this.oldRank - 1;
|
|
2491
|
+
let newIndex = j;
|
|
2492
|
+
while (j < this.maxIndex && Team.compare(this.teams[j], this.teams[j + 1]) > 0) {
|
|
2493
|
+
[this.teams[j], this.teams[j + 1]] = [this.teams[j + 1], this.teams[j]];
|
|
2494
|
+
this.teams[j].rank = j + 1;
|
|
2495
|
+
this.teams[j + 1].rank = j + 2;
|
|
2496
|
+
newIndex = j + 1;
|
|
2497
|
+
j++;
|
|
2498
|
+
}
|
|
2499
|
+
this.currentIndex = newIndex;
|
|
2500
|
+
}
|
|
2501
|
+
}
|
|
2502
|
+
}
|
|
2503
|
+
|
|
2504
|
+
export { Award, Balloon, BattleOfGiants, CodeforcesGymGhostDATConverter, Contest, ContestIndex, ContestIndexConfig, ContestOptions, GeneralExcelConverter, Giants, GiantsType, ICPCStandingsCsvConverter, MedalType, Person, PlaceChartPointData, Problem, ProblemStatistics, Rank, RankOptions, RankStatistics, Rating, RatingCalculator, RatingHistory, RatingLevel, RatingLevelToString, RatingUser, RatingUtility, Resolver, ResolverVue, Submission, Team, TeamProblemStatistics, calcDirt, createContest, createContestIndex, createContestIndexList, createDayJS, createPersons, createProblem, createProblems, createProblemsByProblemIds, createSubmission, createSubmissions, createTeam, createTeams, getImageSource, getTimeDiff, getTimestamp, getWhiteOrBlackColor, getWhiteOrBlackColorV1, 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.52.0",
|
|
4
4
|
"description": "XCPCIO Core",
|
|
5
5
|
"author": "Dup4 <lyuzhi.pan@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -49,14 +49,14 @@
|
|
|
49
49
|
"papaparse": "^5.4.1",
|
|
50
50
|
"string-width": "^6.1.0",
|
|
51
51
|
"xlsx-js-style": "^1.2.0",
|
|
52
|
-
"@xcpcio/types": "0.
|
|
52
|
+
"@xcpcio/types": "0.52.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@babel/types": "^7.25.6",
|
|
56
56
|
"@types/chroma-js": "^2.4.4",
|
|
57
57
|
"@types/color-diff": "^1.2.5",
|
|
58
58
|
"@types/lodash": "^4.17.9",
|
|
59
|
-
"@types/node": "^
|
|
59
|
+
"@types/node": "^18.19.54",
|
|
60
60
|
"@types/papaparse": "^5.3.14",
|
|
61
61
|
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
62
62
|
"@typescript-eslint/parser": "^5.62.0",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"typescript": "^4.9.5",
|
|
70
70
|
"unbuild": "^0.7.6",
|
|
71
71
|
"vite": "^4.5.5",
|
|
72
|
-
"vitest": "^
|
|
72
|
+
"vitest": "^2.1.2"
|
|
73
73
|
},
|
|
74
74
|
"scripts": {
|
|
75
75
|
"build": "unbuild",
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { Resolver } from "./resolver";
|
|
2
|
+
import { Team } from "./team";
|
|
3
|
+
import type { Teams } from "./team";
|
|
4
|
+
import type { Submissions } from "./submission";
|
|
5
|
+
import type { Contest } from "./contest";
|
|
6
|
+
|
|
7
|
+
export class ResolverVue extends Resolver {
|
|
8
|
+
readonly FLASHING_TIME_MS = 100;
|
|
9
|
+
readonly ROLLING_TIME_MS = 600;
|
|
10
|
+
|
|
11
|
+
maxIndex: number;
|
|
12
|
+
currentIndex: number;
|
|
13
|
+
|
|
14
|
+
maxOpIndex: number;
|
|
15
|
+
currentOpIndex: number;
|
|
16
|
+
|
|
17
|
+
oldRank: number;
|
|
18
|
+
newRank: number;
|
|
19
|
+
|
|
20
|
+
currentTeamId: string;
|
|
21
|
+
currentProblemIndex: number;
|
|
22
|
+
|
|
23
|
+
problemFlashingEnded: boolean;
|
|
24
|
+
duringAnimation: boolean;
|
|
25
|
+
|
|
26
|
+
startScrollUp: boolean;
|
|
27
|
+
startScrollDown: boolean;
|
|
28
|
+
|
|
29
|
+
constructor(contest: Contest, teams: Teams, submissions: Submissions) {
|
|
30
|
+
super(contest, teams, submissions);
|
|
31
|
+
|
|
32
|
+
this.maxIndex = 0;
|
|
33
|
+
this.currentIndex = 0;
|
|
34
|
+
|
|
35
|
+
this.maxOpIndex = 0;
|
|
36
|
+
this.currentOpIndex = 0;
|
|
37
|
+
|
|
38
|
+
this.oldRank = -1;
|
|
39
|
+
this.newRank = -1;
|
|
40
|
+
|
|
41
|
+
this.currentTeamId = "";
|
|
42
|
+
this.currentProblemIndex = -1;
|
|
43
|
+
|
|
44
|
+
this.problemFlashingEnded = true;
|
|
45
|
+
this.duringAnimation = false;
|
|
46
|
+
|
|
47
|
+
this.startScrollUp = false;
|
|
48
|
+
this.startScrollDown = false;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
buildResolver() {
|
|
52
|
+
super.buildResolver();
|
|
53
|
+
|
|
54
|
+
this.maxIndex = this.teams.length - 1;
|
|
55
|
+
this.currentIndex = this.maxIndex;
|
|
56
|
+
|
|
57
|
+
this.maxOpIndex = this.operations.length - 1;
|
|
58
|
+
this.currentOpIndex = 0;
|
|
59
|
+
|
|
60
|
+
this.oldRank = -1;
|
|
61
|
+
this.newRank = -1;
|
|
62
|
+
|
|
63
|
+
this.currentTeamId = "";
|
|
64
|
+
this.currentProblemIndex = -1;
|
|
65
|
+
|
|
66
|
+
this.problemFlashingEnded = true;
|
|
67
|
+
this.duringAnimation = false;
|
|
68
|
+
|
|
69
|
+
this.startScrollUp = false;
|
|
70
|
+
this.startScrollDown = false;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
next() {
|
|
74
|
+
if (this.duringAnimation) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (this.currentOpIndex > this.maxOpIndex) {
|
|
79
|
+
if (this.currentIndex > 0) {
|
|
80
|
+
this.currentIndex--;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const op = this.operations[this.currentOpIndex];
|
|
87
|
+
const pIx = op.problemIx;
|
|
88
|
+
const teamId = op.team.id;
|
|
89
|
+
const team = this.teamsMap.get(teamId) as Team;
|
|
90
|
+
const currentRank = team.rank;
|
|
91
|
+
|
|
92
|
+
if (this.currentIndex + 1 > currentRank) {
|
|
93
|
+
this.currentIndex--;
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (this.currentIndex + 1 !== currentRank) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
team.problemStatistics[pIx] = op.afterTeamProblemStatistics;
|
|
102
|
+
team.calcSolvedData(this.contest.options);
|
|
103
|
+
|
|
104
|
+
this.currentProblemIndex = pIx;
|
|
105
|
+
this.currentTeamId = teamId;
|
|
106
|
+
|
|
107
|
+
{
|
|
108
|
+
this.oldRank = team.rank;
|
|
109
|
+
this.newRank = this.oldRank;
|
|
110
|
+
for (let j = this.currentIndex - 1; j >= 0; j--) {
|
|
111
|
+
if (Team.compare(team, this.teams[j]) < 0) {
|
|
112
|
+
this.newRank = this.teams[j].rank;
|
|
113
|
+
} else {
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
this.currentOpIndex++;
|
|
120
|
+
|
|
121
|
+
{
|
|
122
|
+
let j = this.oldRank - 1;
|
|
123
|
+
|
|
124
|
+
while (j >= 0 && Team.compare(this.teams[j], this.teams[j - 1]) < 0) {
|
|
125
|
+
[this.teams[j], this.teams[j - 1]] = [this.teams[j - 1], this.teams[j]];
|
|
126
|
+
this.teams[j].rank = j + 1;
|
|
127
|
+
this.teams[j - 1].rank = j;
|
|
128
|
+
j--;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
rewind() {
|
|
134
|
+
if (this.duringAnimation) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (this.currentOpIndex < 1) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
this.currentOpIndex--;
|
|
143
|
+
|
|
144
|
+
const op = this.operations[this.currentOpIndex];
|
|
145
|
+
const pIx = op.problemIx;
|
|
146
|
+
const teamId = op.team.id;
|
|
147
|
+
const team = this.teamsMap.get(teamId) as Team;
|
|
148
|
+
|
|
149
|
+
team.problemStatistics[pIx] = op.beforeTeamProblemStatistics;
|
|
150
|
+
team.calcSolvedData(this.contest.options);
|
|
151
|
+
|
|
152
|
+
this.currentProblemIndex = pIx;
|
|
153
|
+
this.currentTeamId = teamId;
|
|
154
|
+
|
|
155
|
+
{
|
|
156
|
+
this.oldRank = team.rank;
|
|
157
|
+
this.newRank = this.oldRank;
|
|
158
|
+
for (let j = this.currentIndex + 1; j <= this.maxIndex; j++) {
|
|
159
|
+
if (Team.compare(team, this.teams[j]) > 0) {
|
|
160
|
+
this.newRank = this.teams[j].rank;
|
|
161
|
+
} else {
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
{
|
|
168
|
+
let j = this.oldRank - 1;
|
|
169
|
+
let newIndex = j;
|
|
170
|
+
|
|
171
|
+
while (j < this.maxIndex && Team.compare(this.teams[j], this.teams[j + 1]) > 0) {
|
|
172
|
+
[this.teams[j], this.teams[j + 1]] = [this.teams[j + 1], this.teams[j]];
|
|
173
|
+
this.teams[j].rank = j + 1;
|
|
174
|
+
this.teams[j + 1].rank = j + 2;
|
|
175
|
+
newIndex = j + 1;
|
|
176
|
+
j++;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
this.currentIndex = newIndex;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|