Skip to content

Commit 549d059

Browse files
committed
Team scores
1 parent 124c975 commit 549d059

1 file changed

Lines changed: 38 additions & 46 deletions

File tree

src/components/table/team-modal.tsx

Lines changed: 38 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -100,56 +100,48 @@ export const TeamModal = ({ open, onClose, team }: TeamModalProps) => {
100100
teamwork,
101101
comment,
102102
round,
103-
team_id,
104103
}: {
105-
scoreId: string;
106-
design: number;
107-
implementation: number;
108-
presentation: number;
109-
innovation: number;
110-
teamwork: number;
111-
comment: string;
112-
round: number,
113-
team_id: string
114-
}) => updateScore({
115-
scoreId,
116-
design,
117-
implementation,
118-
presentation,
119-
innovation,
120-
teamwork,
121-
comment,
122-
round,
123-
}),
124-
onError: (err: any) => {
125-
create(`Error updating score: ${err?.message ?? "unknown error"}`, "error");
126-
},
127-
onSuccess: () => {
128-
queryClient.invalidateQueries({ queryKey: ["scores", team.ID] });
129-
setEditMode(false);
130-
resetForm();
131-
},
132-
});
104+
scoreId: string,
105+
design: number,
106+
implementation: number,
107+
presentation: number,
108+
innovation: number,
109+
teamwork: number,
110+
comment: string,
111+
round: number,
112+
}) => updateScore({
113+
scoreId,
114+
design,
115+
implementation,
116+
presentation,
117+
innovation,
118+
teamwork,
119+
comment,
120+
round
121+
}),
122+
onError: (err: any) => {
123+
create(`Error updating score: ${err?.message ?? "unknown error"}`, "error");
124+
},
125+
onSuccess: () => {
126+
queryClient.invalidateQueries({ queryKey: ["scores", team.ID] });
127+
setEditMode(false);
128+
resetForm();
129+
},
130+
});
133131

134-
const handleUpdateScore = async () => {
135-
if (!currentScoreId) return;
136-
if(isNaN(Number(design)) || isNaN(Number(implementation)) || isNaN(Number(presentation)) || isNaN(Number(innovation))|| isNaN(Number(teamwork)) || isNaN(Number(round))){
137-
create("The score should be a number","error");
138-
return;
139-
}
140-
await updateScoreMutation.mutateAsync({
141-
scoreId: currentScoreId,
142-
design,
143-
implementation,
144-
presentation,
145-
innovation,
146-
teamwork,
147-
comment,
148-
round,
149-
team_id: team.ID
132+
const handleUpdateScore = async () => {
133+
if (!currentScoreId) return;
134+
await updateScoreMutation.mutateAsync({
135+
scoreId: currentScoreId,
136+
design,
137+
implementation,
138+
presentation,
139+
innovation,
140+
teamwork,
141+
comment,
142+
round,
150143
});
151144
};
152-
153145
const resetForm = () => {
154146
setDesign(0);
155147
setImplementation(0);

0 commit comments

Comments
 (0)