gg
This commit is contained in:
@@ -22,6 +22,7 @@ import {
|
||||
BasketballTeamStats,
|
||||
} from "./feeder.types";
|
||||
import { ImageUtils } from "../../common/utils/image.util";
|
||||
import { deriveStoredMatchStatus } from "../../common/utils/match-status.util";
|
||||
|
||||
@Injectable()
|
||||
export class FeederPersistenceService {
|
||||
@@ -311,33 +312,15 @@ export class FeederPersistenceService {
|
||||
headerData?.htScoreAway ??
|
||||
this.safeInt(matchSummary.score?.ht?.away);
|
||||
|
||||
let status = "NS";
|
||||
if (headerData?.matchStatus) {
|
||||
if (
|
||||
headerData.matchStatus === "postGame" ||
|
||||
headerData.matchStatus === "post"
|
||||
) {
|
||||
status = "FT";
|
||||
} else if (
|
||||
headerData.matchStatus === "live" ||
|
||||
headerData.matchStatus === "liveGame"
|
||||
) {
|
||||
status = "LIVE";
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Postponed Matches (ERT)
|
||||
if (matchSummary.statusBoxContent === "ERT") {
|
||||
status = "POSTPONED";
|
||||
}
|
||||
|
||||
if (
|
||||
status === "NS" &&
|
||||
finalScoreHome !== null &&
|
||||
finalScoreAway !== null
|
||||
) {
|
||||
status = "FT";
|
||||
}
|
||||
const status = deriveStoredMatchStatus({
|
||||
state: headerData?.matchStatus ?? matchSummary.state,
|
||||
status: matchSummary.status,
|
||||
substate: matchSummary.substate,
|
||||
statusBoxContent: matchSummary.statusBoxContent,
|
||||
scoreHome: finalScoreHome,
|
||||
scoreAway: finalScoreAway,
|
||||
score: matchSummary.score,
|
||||
});
|
||||
|
||||
await tx.match.upsert({
|
||||
where: { id: matchId },
|
||||
@@ -870,15 +853,11 @@ export class FeederPersistenceService {
|
||||
}
|
||||
|
||||
async getExistingMatchIds(matchIds: string[]): Promise<string[]> {
|
||||
// Only consider matches "existing" if they have ALL key data points
|
||||
// This allows re-fetching matches that exist but have missing data
|
||||
const matches = await this.prisma.match.findMany({
|
||||
where: {
|
||||
id: { in: matchIds },
|
||||
AND: [
|
||||
{ oddCategories: { some: {} } },
|
||||
{ playerEvents: { some: {} } },
|
||||
{ officials: { some: {} } },
|
||||
{
|
||||
OR: [
|
||||
{ footballTeamStats: { some: {} } },
|
||||
|
||||
Reference in New Issue
Block a user