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
38946b0d
Commit
38946b0d
authored
Feb 20, 2026
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix indentation error in fixtures API logging
parent
b5bb674b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
60 deletions
+60
-60
routes.py
mbetterclient/web_dashboard/routes.py
+60
-60
No files found.
mbetterclient/web_dashboard/routes.py
View file @
38946b0d
...
...
@@ -10778,67 +10778,67 @@ def get_overlay_fixtures():
all_matches
=
[]
if
yesterday_incomplete_matches
:
logger
.
info
(
f
"[FIXTURES API] Found {len(yesterday_incomplete_matches)} incomplete matches from yesterday - including them"
)
all_matches
.
extend
(
yesterday_incomplete_matches
)
all_matches
.
extend
(
today_matches
)
# Limit to 5 matches total
display_matches
=
all_matches
[:
5
]
logger
.
info
(
f
"[FIXTURES API] Processing {len(display_matches)} matches for display"
)
fixtures_data
=
[]
for
i
,
match
in
enumerate
(
display_matches
):
try
:
logger
.
info
(
f
"[FIXTURES API] Processing match {i+1}: id={match.id}, match_number={match.match_number}"
)
# Get outcomes from MatchOutcomeModel
outcomes
=
session
.
query
(
MatchOutcomeModel
)
.
filter_by
(
match_id
=
match
.
id
)
.
all
()
logger
.
info
(
f
"[FIXTURES API] Found {len(outcomes)} outcomes for match {match.id}"
)
# Format outcomes as array expected by template
outcomes_array
=
[]
for
outcome
in
outcomes
:
outcomes_array
.
append
({
'outcome_name'
:
outcome
.
column_name
,
'outcome_value'
:
outcome
.
float_value
})
# If no outcomes in database, create default ones from match odds
if
not
outcomes_array
:
outcomes_array
=
[
{
'outcome_name'
:
'WIN1'
,
'outcome_value'
:
float
(
match
.
odds_fighter1
)
if
match
.
odds_fighter1
else
1.0
},
{
'outcome_name'
:
'X'
,
'outcome_value'
:
float
(
match
.
odds_draw
)
if
match
.
odds_draw
else
3.0
},
{
'outcome_name'
:
'WIN2'
,
'outcome_value'
:
float
(
match
.
odds_fighter2
)
if
match
.
odds_fighter2
else
1.0
},
{
'outcome_name'
:
'UNDER'
,
'outcome_value'
:
1.75
},
{
'outcome_name'
:
'OVER'
,
'outcome_value'
:
2.05
}
]
match_data
=
{
'id'
:
match
.
id
,
'match_number'
:
match
.
match_number
,
'fixture_id'
:
match
.
fixture_id
,
'fighter1_township'
:
match
.
fighter1_township
,
'fighter2_township'
:
match
.
fighter2_township
,
'venue_kampala_township'
:
match
.
venue_kampala_township
,
'status'
:
match
.
status
,
'start_time'
:
match
.
start_time
.
isoformat
()
if
match
.
start_time
else
None
,
'result'
:
match
.
result
,
'outcomes'
:
outcomes_array
,
# Array format expected by template
# Keep odds for backwards compatibility
'odds'
:
{
'fighter1'
:
float
(
match
.
odds_fighter1
)
if
match
.
odds_fighter1
else
1.0
,
'fighter2'
:
float
(
match
.
odds_fighter2
)
if
match
.
odds_fighter2
else
1.0
,
'draw'
:
float
(
match
.
odds_draw
)
if
match
.
odds_draw
else
3.0
}
all_matches
.
extend
(
yesterday_incomplete_matches
)
all_matches
.
extend
(
today_matches
)
# Limit to 5 matches total
display_matches
=
all_matches
[:
5
]
logger
.
info
(
f
"[FIXTURES API] Processing {len(display_matches)} matches for display"
)
fixtures_data
=
[]
for
i
,
match
in
enumerate
(
display_matches
):
try
:
logger
.
info
(
f
"[FIXTURES API] Processing match {i+1}: id={match.id}, match_number={match.match_number}"
)
# Get outcomes from MatchOutcomeModel
outcomes
=
session
.
query
(
MatchOutcomeModel
)
.
filter_by
(
match_id
=
match
.
id
)
.
all
()
logger
.
info
(
f
"[FIXTURES API] Found {len(outcomes)} outcomes for match {match.id}"
)
# Format outcomes as array expected by template
outcomes_array
=
[]
for
outcome
in
outcomes
:
outcomes_array
.
append
({
'outcome_name'
:
outcome
.
column_name
,
'outcome_value'
:
outcome
.
float_value
})
# If no outcomes in database, create default ones from match odds
if
not
outcomes_array
:
outcomes_array
=
[
{
'outcome_name'
:
'WIN1'
,
'outcome_value'
:
float
(
match
.
odds_fighter1
)
if
match
.
odds_fighter1
else
1.0
},
{
'outcome_name'
:
'X'
,
'outcome_value'
:
float
(
match
.
odds_draw
)
if
match
.
odds_draw
else
3.0
},
{
'outcome_name'
:
'WIN2'
,
'outcome_value'
:
float
(
match
.
odds_fighter2
)
if
match
.
odds_fighter2
else
1.0
},
{
'outcome_name'
:
'UNDER'
,
'outcome_value'
:
1.75
},
{
'outcome_name'
:
'OVER'
,
'outcome_value'
:
2.05
}
]
match_data
=
{
'id'
:
match
.
id
,
'match_number'
:
match
.
match_number
,
'fixture_id'
:
match
.
fixture_id
,
'fighter1_township'
:
match
.
fighter1_township
,
'fighter2_township'
:
match
.
fighter2_township
,
'venue_kampala_township'
:
match
.
venue_kampala_township
,
'status'
:
match
.
status
,
'start_time'
:
match
.
start_time
.
isoformat
()
if
match
.
start_time
else
None
,
'result'
:
match
.
result
,
'outcomes'
:
outcomes_array
,
# Array format expected by template
# Keep odds for backwards compatibility
'odds'
:
{
'fighter1'
:
float
(
match
.
odds_fighter1
)
if
match
.
odds_fighter1
else
1.0
,
'fighter2'
:
float
(
match
.
odds_fighter2
)
if
match
.
odds_fighter2
else
1.0
,
'draw'
:
float
(
match
.
odds_draw
)
if
match
.
odds_draw
else
3.0
}
fixtures_data
.
append
(
match_data
)
logger
.
info
(
f
"[FIXTURES API] Successfully processed match {match.id}"
)
except
Exception
as
match_error
:
logger
.
error
(
f
"[FIXTURES API] Error processing match {match.id}: {match_error}"
)
continue
logger
.
info
(
f
"[FIXTURES API] Returning {len(fixtures_data)} matches"
)
return
jsonify
(
fixtures_data
)
}
fixtures_data
.
append
(
match_data
)
logger
.
info
(
f
"[FIXTURES API] Successfully processed match {match.id}"
)
except
Exception
as
match_error
:
logger
.
error
(
f
"[FIXTURES API] Error processing match {match.id}: {match_error}"
)
continue
logger
.
info
(
f
"[FIXTURES API] Returning {len(fixtures_data)} matches"
)
return
jsonify
(
fixtures_data
)
finally
:
session
.
close
()
...
...
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