This repository has been archived by the owner on Jan 3, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Waiting List Frontend * implement waiting list management * run rubocop * fix eslint * correctly show the number of waiting competitors * check length of waiting too * don't force organizers to update the waitlist everytime someone is approved * adding tests for waiting list * waiting list tests passing * refactored waiting list functions * added cache invalidations * corrected typing of test values and updated type acceptance tests * added tests for waiting list position outside of min/max boundary * re-enabled cache * caching tests * Fixed caches not updating and introduced a method in lib * corrected cache behaviour * removed puts statements * removed get/set and refactored to use minmax * removed caching-test config files * remove cache_test fro mgemfile * refactored list_waiting to use get_by_status * skipping jwt validation on list_waiting temproarily * removed caching of waiting list * removed commented code and unnecessary docs * fix issue with worker not loading lane * fix issue with multiple updates not waiting before the other completes * fix typo * Add Segment for Waiting List * run eslint * added redis to backend-test compose file --------- Co-authored-by: Duncan <duncanonthejob@gmail.com>
- Loading branch information
1 parent
f3110e7
commit 072b266
Showing
24 changed files
with
813 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { useQuery } from '@tanstack/react-query' | ||
import React, { useContext } from 'react' | ||
import { Table, TableFooter } from 'semantic-ui-react' | ||
import { CompetitionContext } from '../../../api/helper/context/competition_context' | ||
import { getWaitingCompetitors } from '../../../api/registration/get/get_registrations' | ||
import { setMessage } from '../../../ui/events/messages' | ||
import LoadingMessage from '../../../ui/messages/loadingMessage' | ||
|
||
export default function WaitingList() { | ||
const { competitionInfo } = useContext(CompetitionContext) | ||
const { isLoading, data: waiting } = useQuery({ | ||
queryKey: ['waiting', competitionInfo.id], | ||
queryFn: () => getWaitingCompetitors(competitionInfo.id), | ||
retry: false, | ||
onError: (err) => { | ||
setMessage(err.message, 'error') | ||
}, | ||
}) | ||
return isLoading ? ( | ||
<LoadingMessage /> | ||
) : ( | ||
<Table> | ||
<Table.Header> | ||
<Table.Row> | ||
<Table.HeaderCell>Name</Table.HeaderCell> | ||
<Table.HeaderCell>Position</Table.HeaderCell> | ||
</Table.Row> | ||
</Table.Header> | ||
<Table.Body> | ||
{waiting?.length ? ( | ||
waiting | ||
.sort( | ||
(w1, w2) => | ||
w1.competing.waiting_list_position - | ||
w2.competing.waiting_list_position | ||
) // Once a waiting list is established, we just care about the order of the waitlisted competitors | ||
.map((w, i) => ( | ||
<Table.Row key={w.user_id}> | ||
<Table.Cell>{w.user.name}</Table.Cell> | ||
<Table.Cell> | ||
{w.competing.waiting_list_position === 0 | ||
? 'Not yet assigned' | ||
: i + 1} | ||
</Table.Cell> | ||
</Table.Row> | ||
)) | ||
) : ( | ||
<TableFooter>No one on the Waiting List.</TableFooter> | ||
)} | ||
</Table.Body> | ||
</Table> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react' | ||
import { Header, Segment } from 'semantic-ui-react' | ||
import WaitingList from './components/WaitingList' | ||
|
||
export default function Waiting() { | ||
return ( | ||
<Segment padded attached> | ||
<Header>Waiting List:</Header> | ||
<WaitingList /> | ||
</Segment> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.