Feat: auto-reload
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Dorian Zedler 2022-07-29 09:45:12 +02:00
parent bd72659215
commit c730b182a9
Signed by: dorian
GPG Key ID: 989DE36109AFA354
3 changed files with 14 additions and 12 deletions

View File

@ -75,8 +75,6 @@ function computeWinnerOfPair(pair: SpeedRoundPair, roundIndex: number) {
)
return;
console.log('Conputing winner of round ', roundIndex);
pair.laneA.result = pair.laneA.participant.results[roundIndex];
pair.laneB.result = pair.laneB.participant.results[roundIndex];
@ -212,7 +210,6 @@ export function convertResultsToSpeedFlowchartResult(
// - 1, 4, 2, 3 for firstRoundNumber=4
// - 1, 2 for firstRoundNumber=2
// TODO: come up with a proper alogorithm maybe
console.log('First round rank: ', firstRoundRank);
const ranksOfLaneAInOrder = [
[1, 2],
[1, 4, 2, 3],
@ -234,12 +231,9 @@ export function convertResultsToSpeedFlowchartResult(
rounds.push(firstRound);
console.log(firstRound);
// compute following rounds
let roundIndex = roundIndices[1];
for (let roundRank = firstRoundRank; roundRank > 2; roundRank /= 2) {
console.log('Processing rank', roundRank);
rounds.push(
computeRoundFromPreviousRound(
roundIndex,

View File

@ -33,7 +33,6 @@ export default function CalendarPage() {
React.useEffect(() => {
api.getCompetitions('GER').then(result => {
console.log(result.competitions.filter);
competitions.current = result.competitions.filter(competition =>
competition.discipline?.includes('speed'),
);

View File

@ -26,12 +26,22 @@ export default function SpeedFlowchartPage() {
useState<SpeedFlowchartResult>();
useEffect(() => {
if (competitionId === undefined || categoryId === undefined) {
return;
}
setTitle('');
setContainerMaxWidth(false);
loadData();
const interval = setInterval(loadData, 2000);
return () => clearInterval(interval);
}, []);
const loadData = () => {
if (competitionId === undefined || categoryId === undefined) {
setLoading(false);
return;
}
api.getCompetitionResults(competitionId, categoryId).then(r => {
setTitle(
`${r.comp_name} - ${
@ -40,7 +50,6 @@ export default function SpeedFlowchartPage() {
);
setLoading(false);
console.log('loading false');
const flowchartResult = convertResultsToSpeedFlowchartResult(r);
const l = flowchartResult.rounds.length;
@ -56,7 +65,7 @@ export default function SpeedFlowchartPage() {
flowchartResult.rounds.pop();
setFlowchartResult(flowchartResult);
});
}, []);
};
return (
<>