Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

別のリーグにエントリーしているの審判が見えない不具合 #50

Merged
merged 1 commit into from
May 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions components/match/matchEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import CardBackground from "@/components/layout/cardBackground"
import {HiCheck, HiChevronDown, HiArrowPath, HiFlag, HiMapPin, HiClock, HiMiniNoSymbol} from "react-icons/hi2"

import {Sport} from "@/src/models/SportModel"
import {Game} from "@/src/models/GameModel"
import {Game, gameFactory} from "@/src/models/GameModel"
import {Match, matchFactory, MatchResult, MatchStatus} from "@/src/models/MatchModel"
import {Team, teamFactory} from "@/src/models/TeamModel"
import {Location, locationFactory} from "@/src/models/LocationModel"
Expand Down Expand Up @@ -65,9 +65,13 @@ export default function MatchEditor(props: MatchEditorProps) {
const fetchedLocations = await locationFactory().index()
setLocations(fetchedLocations)

const fetchedGames = await gameFactory().index()
const sportGames = fetchedGames.filter(game => game.sportId === props.sport.id)
const sportGameIds = sportGames.map(game => game.id)

const fetchedTeams = await teamFactory().index()
// filter by game id
const filteredTeams = fetchedTeams.filter(team => team.enteredGameIds.includes(props.game.id))
const filteredTeams = fetchedTeams.filter(team => team.enteredGameIds.some(id => sportGameIds.includes(id)))
setTeams(filteredTeams)

// finish loading
Expand Down
Loading