gg
This commit is contained in:
@@ -9,6 +9,13 @@ import {
|
||||
ActiveLeagueDto,
|
||||
} from "./dto";
|
||||
import { Prisma } from "@prisma/client";
|
||||
import {
|
||||
FINISHED_STATE_VALUES_FOR_DB,
|
||||
FINISHED_STATUS_VALUES_FOR_DB,
|
||||
LIVE_STATE_VALUES_FOR_DB,
|
||||
LIVE_STATUS_VALUES_FOR_DB,
|
||||
getDisplayMatchStatus,
|
||||
} from "../../common/utils/match-status.util";
|
||||
|
||||
@Injectable()
|
||||
export class MatchesService {
|
||||
@@ -38,23 +45,12 @@ export class MatchesService {
|
||||
OR: [
|
||||
{
|
||||
status: {
|
||||
in: [
|
||||
"LIVE",
|
||||
"1H",
|
||||
"2H",
|
||||
"HT",
|
||||
"1Q",
|
||||
"2Q",
|
||||
"3Q",
|
||||
"4Q",
|
||||
"Playing",
|
||||
"Half Time",
|
||||
],
|
||||
in: LIVE_STATUS_VALUES_FOR_DB,
|
||||
},
|
||||
},
|
||||
{
|
||||
state: {
|
||||
in: ["live", "firsthalf", "secondhalf"],
|
||||
in: LIVE_STATE_VALUES_FOR_DB,
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -66,14 +62,23 @@ export class MatchesService {
|
||||
OR: [
|
||||
{
|
||||
status: {
|
||||
in: ["Finished", "Played", "FT", "AET", "PEN", "Ended"],
|
||||
in: FINISHED_STATUS_VALUES_FOR_DB,
|
||||
},
|
||||
},
|
||||
{
|
||||
state: {
|
||||
in: ["Finished", "post", "FT", "postGame"],
|
||||
in: FINISHED_STATE_VALUES_FOR_DB,
|
||||
},
|
||||
},
|
||||
{
|
||||
AND: [
|
||||
{ scoreHome: { not: null } },
|
||||
{ scoreAway: { not: null } },
|
||||
{
|
||||
NOT: this.getLiveFilter(),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
@@ -325,16 +330,13 @@ export class MatchesService {
|
||||
}
|
||||
|
||||
// Map status for frontend
|
||||
let displayStatus = match.status || "NS";
|
||||
if (match.state === "live") {
|
||||
displayStatus = "LIVE";
|
||||
} else if (
|
||||
match.state === "post" ||
|
||||
match.state === "FT" ||
|
||||
match.status === "Finished"
|
||||
) {
|
||||
displayStatus = "Finished";
|
||||
}
|
||||
const displayStatus = getDisplayMatchStatus({
|
||||
state: match.state,
|
||||
status: match.status,
|
||||
substate: match.substate,
|
||||
scoreHome: match.scoreHome,
|
||||
scoreAway: match.scoreAway,
|
||||
});
|
||||
|
||||
league.matches.push({
|
||||
id: match.id,
|
||||
@@ -562,16 +564,13 @@ export class MatchesService {
|
||||
|
||||
if (liveMatch) {
|
||||
// Map liveMatch status
|
||||
let displayStatus = liveMatch.status || "NS";
|
||||
if (liveMatch.state === "live") {
|
||||
displayStatus = "LIVE";
|
||||
} else if (
|
||||
liveMatch.state === "post" ||
|
||||
liveMatch.state === "FT" ||
|
||||
liveMatch.status === "Finished"
|
||||
) {
|
||||
displayStatus = "Finished";
|
||||
}
|
||||
const displayStatus = getDisplayMatchStatus({
|
||||
state: liveMatch.state,
|
||||
status: liveMatch.status,
|
||||
substate: liveMatch.substate,
|
||||
scoreHome: liveMatch.scoreHome,
|
||||
scoreAway: liveMatch.scoreAway,
|
||||
});
|
||||
|
||||
match = {
|
||||
...liveMatch,
|
||||
|
||||
Reference in New Issue
Block a user