Skip to content

Commit

Permalink
Merge pull request #213 from osu-tournament-rating/fix/tournament-sub…
Browse files Browse the repository at this point in the history
…mission

Changing Team Size to Format
  • Loading branch information
hburn7 authored Aug 24, 2024
2 parents 250df64 + 08b1dd2 commit d2eabac
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 33 deletions.
14 changes: 5 additions & 9 deletions app/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,21 +206,17 @@ export async function saveTournamentMatches(
});

const data = MatchesSubmitFormSchema.parse({
tournamentName: formData.get('tournamentName'),
name: formData.get('tournamentName'),
abbreviation: formData.get('tournamentAbbreviation'),
forumPost: formData.get('forumPostURL'),
forumUrl: formData.get('forumPostURL'),
rankRangeLowerBound: parseInt(formData.get('rankRestriction')),
teamSize: parseInt(formData.get('teamSize')),
mode: parseInt(formData.get('gameMode')),
submitterId: session?.id ?? 0,
format: parseInt(formData.get('teamSize')),
ruleset: parseInt(formData.get('gameMode')),
ids: matchIDs,
});

let isSubmissionVerified =
formData.get('verifierCheckBox') == 'on' ?? false;

let tournamentSubmit = await fetch(
`${process.env.REACT_APP_API_URL}/tournaments?verify=${isSubmissionVerified}`,
`${process.env.REACT_APP_API_URL}/tournaments`,
{
method: 'POST',
headers: {
Expand Down
2 changes: 1 addition & 1 deletion components/NavBar/Routes/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function Routes() {
href={'/submit'}
className={pathname === '/submit' ? styles.active : ''}
>
Submit Matches
Tournament Submission
</Link>
)}
</div>
Expand Down
19 changes: 1 addition & 18 deletions components/SubmitMatches/MatchForm/MatchForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export default function MatchForm({
<div className={styles.row}>
<div className={styles.field}>
<label htmlFor="teamSize">
Team size
Lobby size
<InfoIcon>
<p>
<span>
Expand Down Expand Up @@ -262,23 +262,6 @@ export default function MatchForm({
matches can lead to a restriction
</span>
</div>
{userScopes.includes('verifier') && (
<div className={clsx(styles.row, styles.checkbox)}>
<input
type="checkbox"
name="verifierCheckBox"
id="verifierCheckBox"
checked={verifierAccepted}
onChange={(e) => {
console.log(e.target.checked);
setVerifierAccepted(e.target.checked);
}}
/>
<span onClick={() => setVerifierAccepted(!verifierAccepted)}>
Force verify
</span>
</div>
)}
</div>
<div className={styles.field}>
<span className={styles.inputError}>
Expand Down
9 changes: 4 additions & 5 deletions lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ export const LeaderboardsQuerySchema = z.object({
});

export const MatchesSubmitFormSchema = z.object({
tournamentName: z.string().min(1),
name: z.string().min(1),
abbreviation: z.string().min(1),
forumPost: z.union([
forumUrl: z.union([
z
.string()
.url()
Expand All @@ -48,9 +48,8 @@ export const MatchesSubmitFormSchema = z.object({
.min(1),
]),
rankRangeLowerBound: z.number().min(1),
teamSize: z.number().min(1).max(8),
mode: z.number().min(0).max(5),
submitterId: z.number().positive(),
format: z.number().min(1).max(8),
ruleset: z.number().min(0).max(5),
ids: z
.array(
z
Expand Down

0 comments on commit d2eabac

Please sign in to comment.