Skip to content

Commit

Permalink
Null checking for available automatches, remove correspondence listings
Browse files Browse the repository at this point in the history
  • Loading branch information
anoek committed Nov 27, 2024
1 parent 5e096c8 commit ea18858
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/views/Play/AvailableQuickMatches.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ export function AvailableQuickMatches(): JSX.Element {
}, []);

const available_list = Object.values(available.current).filter(
(entry) => entry.player.id !== user.id,
(entry) =>
entry.player.id !== user.id &&
entry.preferences.size_speed_options[0].speed !== "correspondence",
);
available_list.sort((a, b) => {
const a_speed = a.preferences.size_speed_options[0].speed;
Expand Down Expand Up @@ -108,11 +110,13 @@ export function AvailableQuickMatches(): JSX.Element {
speed =
system === "fischer"
? `${shortDurationString(
speed_options.initial_time,
)} + ${shortDurationString(speed_options.time_increment)}`
: `${shortDurationString(speed_options.main_time)} + ${
speed_options.periods
}x${shortDurationString(speed_options.period_time)}`;
speed_options?.initial_time,
)} + ${shortDurationString(speed_options?.time_increment)}`
: `${shortDurationString(
speed_options?.main_time,
)} + ${speed_options?.periods}x${shortDurationString(
speed_options?.period_time,
)}`;
} catch (e) {
console.error(e);
}
Expand Down

0 comments on commit ea18858

Please sign in to comment.