-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alex/implement admin league operation #489
Conversation
Gridiron Survivor Application
Project name: Gridiron Survivor Application
Only deployments on the production branch are activated automatically. If you'd like to activate this deployment, navigate to your deployments. Learn more about Appwrite Function deployments.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…errors. The table row can't be a direct child of the header.
…in-league-operation
cell: ({ row }) => <div>{row.getValue('text2')}</div>, | ||
cell: ({ row }): JSX.Element => { | ||
const participants = row.getValue('participants') as string[]; | ||
return <p>{participants.length}</p>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: would span be better for this?
…in-league-operation
…in-league-operation
Closes #480
Shashi requested that I only do these things:
Let me break down what I did and why.
getAllLeagueEntries(); apiFunction:
- in order to get the numbered data for the entries, I had to create an apiFunction to get this and return the length of entries.
- I set the Query.limit to 5000 because appwrite only returns 25 by default (there was more than 25 to bring back).
- the reason it is filtering is because I can't actually query 'league' in the database because it is considered a relationship. So, I had to filter and grab entry.league(the relationship) that is matched with the leagueId that I pass in.
For the page.tsx the
fetchData
is what is needed to grab certain data to pass into the table to be rendered.- the first function gets the number of total entries and entries that aren't eliminated
- the second function gets info from all leagues the user is a part of
- the
combinedData
is there because I was getting data from 2 separate collections in the database. Then, I HAD to combine them into 1 to be able to pass into the table's data={}.The IEntryWithLeague props extends ILeague because it uses almost all props in ILeague
- then I created 2 new props to let it know that I will be receiving them also into the table
- then I am able to define the table column header as
IEntryWithLeague
because it uses all those propsThe cell: {row} grabs the props by their names, so it knows what data it is grabbing to display its value.
- because of fetchData, the table columns works closely with the data props and knows what to display
the accessorKey is the actual identity of the prop it is grabbing
Some will have
as number
at the end, to handle type errors and let the table know that I am specifically rendering a number value.The reason for
sortingFn
for some columns and not all is because originally survivors and participants were a string[] and I grabbed the .length of them. So to accurately sort i had to add the sorting code in.Recording.2024-10-17.174658.mp4