Fix the tournament result search (#249)

This commit is contained in:
Timothy Armes
2024-03-12 08:47:02 +01:00
committed by GitHub
parent 4f5062e1da
commit cd83db2385
4 changed files with 7 additions and 3 deletions
+2
View File
@@ -27,6 +27,8 @@ export const addTournament = publicProcedure
const tournamentData: Omit<TournamentData, "_id" | "tournament_id"> = {
...tournament,
date: format(tournament.date, "dd/MM/yyyy"),
start_date: format(tournament.date, "dd/MM/yyyy"),
end_date: format(tournament.date, "dd/MM/yyyy"),
time_control: tcMap[tournament.time_control],
coordinates: tournament.coordinates as [number, number],
entry_method: "manual",
+2 -2
View File
@@ -47,7 +47,7 @@ export const searchTournaments = publicProcedure
$addFields: {
dateParts: {
$dateFromString: {
dateString: "$end_date",
dateString: "$start_date",
format: "%d/%m/%Y",
},
},
@@ -83,7 +83,7 @@ export const searchTournaments = publicProcedure
tournament: t.tournament,
town: t.town,
department: t.department,
date: t.date,
date: t.start_date,
url: t.url,
timeControl,
status: t.status,
+2
View File
@@ -14,6 +14,8 @@ export const tournamentDataSchema = z.object({
time_control: z.string(),
norm_tournament: z.boolean().optional(),
date: z.string(),
start_date: z.string(),
end_date: z.string(),
coordinates: z.array(z.number()).min(2).max(2),
entry_method: z.enum(["manual", "auto"]),
pending: z.boolean().optional(),
+1 -1
View File
@@ -1,6 +1,6 @@
import { clamp, last } from "lodash";
// Fide uses teh following table to establish the chance of winning based on the difference in elo.
// Fide uses the following table to establish the chance of winning based on the difference in elo.
// https://handbook.fide.com/chapter/B022017
const differenceToProbability: [