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
a00788be
Commit
a00788be
authored
Jan 20, 2026
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* fixed extracion outcomes filtering
* print now is automatically on bet insertion
parent
4d8fb1f1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
30 deletions
+63
-30
games_thread.py
mbetterclient/core/games_thread.py
+42
-27
admin_bet_details.html
.../web_dashboard/templates/dashboard/admin_bet_details.html
+10
-1
admin_new_bet.html
...ient/web_dashboard/templates/dashboard/admin_new_bet.html
+1
-1
bet_details.html
...client/web_dashboard/templates/dashboard/bet_details.html
+9
-0
new_bet.html
mbetterclient/web_dashboard/templates/dashboard/new_bet.html
+1
-1
No files found.
mbetterclient/core/games_thread.py
View file @
a00788be
...
...
@@ -1289,34 +1289,53 @@ class GamesThread(ThreadedComponent):
return
None
def
_initialize_new_fixture
(
self
)
->
Optional
[
str
]:
"""Initialize a new fixture by finding the first one w
ith no start_time set
, or create one from old matches"""
"""Initialize a new fixture by finding the first one w
here ALL matches have start_time NULL or today
, or create one from old matches"""
try
:
session
=
self
.
db_manager
.
get_session
()
try
:
# First, try to find the first fixture with no start_time set
fixtures_no_start_time
=
session
.
query
(
MatchModel
.
fixture_id
)
.
filter
(
MatchModel
.
start_time
.
is_
(
None
),
MatchModel
.
active_status
==
True
# Get today's date in UTC (consistent with database storage)
today
=
self
.
_get_today_utc_date
()
# Find candidate fixtures that have at least one match with start_time NULL or today
candidate_fixtures
=
session
.
query
(
MatchModel
.
fixture_id
)
.
filter
(
MatchModel
.
active_status
==
True
,
((
MatchModel
.
start_time
.
is_
(
None
))
|
(
MatchModel
.
start_time
>=
datetime
.
combine
(
today
,
datetime
.
min
.
time
()))
&
(
MatchModel
.
start_time
<
datetime
.
combine
(
today
,
datetime
.
max
.
time
())))
)
.
distinct
()
.
order_by
(
MatchModel
.
created_at
.
asc
())
.
all
()
if
fixtures_no_start_time
:
fixture_id
=
fixtures_no_start_time
[
0
]
.
fixture_id
logger
.
info
(
f
"Initializing existing fixture with no start_time: {fixture_id}"
)
# Check each candidate fixture to ensure ALL matches are NULL or today
for
fixture_row
in
candidate_fixtures
:
fixture_id
=
fixture_row
.
fixture_id
# Set start_time to now for all matches in this fixture
now
=
datetime
.
utcnow
()
matches
=
session
.
query
(
MatchModel
)
.
filter
(
# Get all matches for this fixture
all_matches
=
session
.
query
(
MatchModel
)
.
filter
(
MatchModel
.
fixture_id
==
fixture_id
,
MatchModel
.
active_status
==
True
)
.
all
()
for
match
in
matches
:
match
.
start_time
=
now
match
.
status
=
'scheduled'
logger
.
debug
(
f
"Set start_time for match {match.match_number}"
)
# Check if ALL matches have start_time NULL or today
all_valid
=
all
(
match
.
start_time
is
None
or
match
.
start_time
.
date
()
==
today
for
match
in
all_matches
)
session
.
commit
()
return
fixture_id
if
all_valid
:
logger
.
info
(
f
"Initializing existing fixture where all matches are NULL or today: {fixture_id}"
)
# Set start_time to now for matches that don't have it
now
=
datetime
.
utcnow
()
for
match
in
all_matches
:
if
match
.
start_time
is
None
:
match
.
start_time
=
now
match
.
status
=
'scheduled'
logger
.
debug
(
f
"Set/confirmed start_time for match {match.match_number}"
)
session
.
commit
()
return
fixture_id
# No suitable existing fixtures found - create new fixture from old matches
logger
.
info
(
"No fixtures found where all matches are NULL or today - creating new fixture from old completed matches"
)
# No fixtures with no start_time found - create a new fixture from old completed matches
logger
.
info
(
"No fixtures with no start_time found - creating new fixture from old completed matches"
)
...
...
@@ -2552,6 +2571,9 @@ class GamesThread(ThreadedComponent):
ExtractionAssociationModel
.
extraction_result
==
selected_result
)
.
distinct
()
.
all
()
extraction_winning_outcome_names
=
[
outcome
.
outcome_name
for
outcome
in
winning_outcomes
]
# Filter winning outcomes to only include those available in the match fixture
extraction_winning_outcome_names
=
[
outcome
for
outcome
in
extraction_winning_outcome_names
if
outcome
in
available_outcome_names
]
logger
.
info
(
f
"🏆 [EXTRACTION DEBUG] Winning outcomes for result '{selected_result}': {extraction_winning_outcome_names}"
)
# Log expected redistribution and actual selected payout
...
...
@@ -2762,16 +2784,9 @@ class GamesThread(ThreadedComponent):
# extraction_winning_outcome_names is already passed as parameter
logger
.
info
(
f
"DEBUG _update_bet_results: Using passed extraction_winning_outcome_names: {extraction_winning_outcome_names}"
)
# Get possible outcomes for this match
possible_outcomes
=
session
.
query
(
MatchOutcomeModel
.
column_name
)
.
filter
(
MatchOutcomeModel
.
match_id
==
match_id
)
.
all
()
possible_outcome_names
=
[
outcome
.
column_name
for
outcome
in
possible_outcomes
]
logger
.
info
(
f
"DEBUG _update_bet_results: Match {match_id} has {len(possible_outcomes)} possible outcomes: {possible_outcome_names}"
)
# Filter winning outcomes to only include those that are possible for this match
winning_outcome_names
=
[
outcome
for
outcome
in
extraction_winning_outcome_names
if
outcome
in
possible_outcome_names
]
logger
.
info
(
f
"DEBUG _update_bet_results: After filtering against possible outcomes, {len(winning_outcome_names)} winning outcomes remain: {winning_outcome_names}"
)
# Winning outcomes are now pre-filtered in _perform_result_extraction
winning_outcome_names
=
extraction_winning_outcome_names
logger
.
info
(
f
"DEBUG _update_bet_results: Using pre-filtered winning outcomes: {winning_outcome_names}"
)
# Set the main result (selected_result)
match
.
result
=
selected_result
...
...
mbetterclient/web_dashboard/templates/dashboard/admin_bet_details.html
View file @
a00788be
...
...
@@ -478,9 +478,18 @@ document.addEventListener('currencySettingsLoaded', function(event) {
});
document
.
addEventListener
(
'DOMContentLoaded'
,
function
()
{
// Check for print parameter and automatically print if present
const
urlParams
=
new
URLSearchParams
(
window
.
location
.
search
);
if
(
urlParams
.
get
(
'print'
)
===
'true'
)
{
// Automatically print the ticket after a short delay to ensure page is fully loaded
setTimeout
(()
=>
{
directPrintBet
(
window
.
betData
.
uuid
);
},
1000
);
}
// Generate QR code for bet verification
generateBetVerificationQR
();
// Cancel entire bet button
const
cancelBetBtn
=
document
.
getElementById
(
'btn-cancel-bet'
);
if
(
cancelBetBtn
)
{
...
...
mbetterclient/web_dashboard/templates/dashboard/admin_new_bet.html
View file @
a00788be
...
...
@@ -819,7 +819,7 @@ function submitBet() {
if
(
data
.
success
)
{
showNotification
(
'Bet submitted successfully!'
,
'success'
);
setTimeout
(()
=>
{
window
.
location
.
href
=
`/bets/
${
data
.
bet_id
}
`
;
window
.
location
.
href
=
`/bets/
${
data
.
bet_id
}
?print=true
`
;
},
1500
);
}
else
{
showNotification
(
'Failed to submit bet: '
+
(
data
.
error
||
'Unknown error'
),
'error'
);
...
...
mbetterclient/web_dashboard/templates/dashboard/bet_details.html
View file @
a00788be
...
...
@@ -480,6 +480,15 @@ document.addEventListener('currencySettingsLoaded', function(event) {
});
document
.
addEventListener
(
'DOMContentLoaded'
,
function
()
{
// Check for print parameter and automatically print if present
const
urlParams
=
new
URLSearchParams
(
window
.
location
.
search
);
if
(
urlParams
.
get
(
'print'
)
===
'true'
)
{
// Automatically print the ticket after a short delay to ensure page is fully loaded
setTimeout
(()
=>
{
directPrintBet
(
window
.
betData
.
uuid
);
},
1000
);
}
// Generate QR code for bet verification
generateBetVerificationQR
();
...
...
mbetterclient/web_dashboard/templates/dashboard/new_bet.html
View file @
a00788be
...
...
@@ -861,7 +861,7 @@ function submitBet() {
if
(
data
.
success
)
{
showNotification
(
'Bet submitted successfully!'
,
'success'
);
setTimeout
(()
=>
{
window
.
location
.
href
=
`/cashier/bets/
${
data
.
bet_id
}
`
;
window
.
location
.
href
=
`/cashier/bets/
${
data
.
bet_id
}
?print=true
`
;
},
1500
);
}
else
{
showNotification
(
'Failed to submit bet: '
+
(
data
.
error
||
'Unknown error'
),
'error'
);
...
...
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