Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
MBetterc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mbetter
MBetterc
Commits
f40097d5
Commit
f40097d5
authored
Feb 22, 2026
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix fixture date detection: use first match of fixture to determine date, not any match
parent
12aafd6f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
17 deletions
+30
-17
games_thread.py
mbetterclient/core/games_thread.py
+30
-17
No files found.
mbetterclient/core/games_thread.py
View file @
f40097d5
...
@@ -132,7 +132,13 @@ class GamesThread(ThreadedComponent):
...
@@ -132,7 +132,13 @@ class GamesThread(ThreadedComponent):
return
False
return
False
def
_is_fixture_from_yesterday
(
self
,
fixture_id
:
str
,
session
)
->
bool
:
def
_is_fixture_from_yesterday
(
self
,
fixture_id
:
str
,
session
)
->
bool
:
"""Check if the specified fixture has any matches from yesterday"""
"""Check if the specified fixture is from yesterday.
A fixture is considered 'from yesterday' if the FIRST match of the fixture
(determined by match_number) has a start_time from yesterday.
The fixture date is determined by the first match, regardless of whether
that match is completed or not.
"""
try
:
try
:
if
not
fixture_id
:
if
not
fixture_id
:
return
False
return
False
...
@@ -140,29 +146,36 @@ class GamesThread(ThreadedComponent):
...
@@ -140,29 +146,36 @@ class GamesThread(ThreadedComponent):
# Get today's date in venue timezone
# Get today's date in venue timezone
today
=
self
.
_get_today_venue_date
()
today
=
self
.
_get_today_venue_date
()
# Get all active matches for this fixture
# Get the FIRST match of the fixture (by match_number)
matches
=
session
.
query
(
MatchModel
)
.
filter
(
# This determines the fixture date, regardless of completion status
first_match
=
session
.
query
(
MatchModel
)
.
filter
(
MatchModel
.
fixture_id
==
fixture_id
,
MatchModel
.
fixture_id
==
fixture_id
,
MatchModel
.
active_status
==
True
MatchModel
.
active_status
==
True
)
.
all
()
)
.
order_by
(
MatchModel
.
match_number
.
asc
())
.
first
()
for
match
in
matches
:
if
not
first_match
:
if
match
.
start_time
:
logger
.
debug
(
f
"Fixture {fixture_id} has no matches"
)
# Convert UTC start_time to venue timezone for date comparison
return
False
from
..utils.timezone_utils
import
utc_to_venue_datetime
venue_start_time
=
utc_to_venue_datetime
(
match
.
start_time
,
self
.
db_manager
)
match_date
=
venue_start_time
.
date
()
# Check if the match date is yesterday
if
not
first_match
.
start_time
:
if
(
today
-
match_date
)
.
days
==
1
:
logger
.
debug
(
f
"First match of fixture {fixture_id} has no start_time"
)
logger
.
debug
(
f
"Fixture {fixture_id} has match from yesterday: {match_date}, today: {today}"
)
return
False
return
True
logger
.
debug
(
f
"Fixture {fixture_id} has no matches from yesterday"
)
# Convert UTC start_time to venue timezone for date comparison
return
False
from
..utils.timezone_utils
import
utc_to_venue_datetime
venue_start_time
=
utc_to_venue_datetime
(
first_match
.
start_time
,
self
.
db_manager
)
match_date
=
venue_start_time
.
date
()
# Check if the first match date is yesterday
days_diff
=
(
today
-
match_date
)
.
days
is_yesterday
=
days_diff
==
1
logger
.
info
(
f
"📅 Fixture {fixture_id} first match #{first_match.match_number} date: {match_date}, today: {today}, days_diff: {days_diff}, is_yesterday: {is_yesterday}"
)
return
is_yesterday
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
error
(
f
"Failed to check if fixture {fixture_id}
has matche
s from yesterday: {e}"
)
logger
.
error
(
f
"Failed to check if fixture {fixture_id}
i
s from yesterday: {e}"
)
return
False
return
False
def
_create_new_fixture_for_continuation
(
self
)
->
Optional
[
str
]:
def
_create_new_fixture_for_continuation
(
self
)
->
Optional
[
str
]:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment