mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-07-23 04:26:57 +00:00
Fix the tournament result search (#249)
This commit is contained in:
@@ -27,6 +27,8 @@ export const addTournament = publicProcedure
|
|||||||
const tournamentData: Omit<TournamentData, "_id" | "tournament_id"> = {
|
const tournamentData: Omit<TournamentData, "_id" | "tournament_id"> = {
|
||||||
...tournament,
|
...tournament,
|
||||||
date: format(tournament.date, "dd/MM/yyyy"),
|
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],
|
time_control: tcMap[tournament.time_control],
|
||||||
coordinates: tournament.coordinates as [number, number],
|
coordinates: tournament.coordinates as [number, number],
|
||||||
entry_method: "manual",
|
entry_method: "manual",
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export const searchTournaments = publicProcedure
|
|||||||
$addFields: {
|
$addFields: {
|
||||||
dateParts: {
|
dateParts: {
|
||||||
$dateFromString: {
|
$dateFromString: {
|
||||||
dateString: "$end_date",
|
dateString: "$start_date",
|
||||||
format: "%d/%m/%Y",
|
format: "%d/%m/%Y",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -83,7 +83,7 @@ export const searchTournaments = publicProcedure
|
|||||||
tournament: t.tournament,
|
tournament: t.tournament,
|
||||||
town: t.town,
|
town: t.town,
|
||||||
department: t.department,
|
department: t.department,
|
||||||
date: t.date,
|
date: t.start_date,
|
||||||
url: t.url,
|
url: t.url,
|
||||||
timeControl,
|
timeControl,
|
||||||
status: t.status,
|
status: t.status,
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ export const tournamentDataSchema = z.object({
|
|||||||
time_control: z.string(),
|
time_control: z.string(),
|
||||||
norm_tournament: z.boolean().optional(),
|
norm_tournament: z.boolean().optional(),
|
||||||
date: z.string(),
|
date: z.string(),
|
||||||
|
start_date: z.string(),
|
||||||
|
end_date: z.string(),
|
||||||
coordinates: z.array(z.number()).min(2).max(2),
|
coordinates: z.array(z.number()).min(2).max(2),
|
||||||
entry_method: z.enum(["manual", "auto"]),
|
entry_method: z.enum(["manual", "auto"]),
|
||||||
pending: z.boolean().optional(),
|
pending: z.boolean().optional(),
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { clamp, last } from "lodash";
|
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
|
// https://handbook.fide.com/chapter/B022017
|
||||||
|
|
||||||
const differenceToProbability: [
|
const differenceToProbability: [
|
||||||
|
|||||||
Reference in New Issue
Block a user