diff --git a/server/fishtest/rundb.py b/server/fishtest/rundb.py
index 20d4da77c..74f487a82 100644
--- a/server/fishtest/rundb.py
+++ b/server/fishtest/rundb.py
@@ -26,6 +26,7 @@
get_chi2,
get_hash,
get_tc_ratio,
+ is_ltc,
post_in_fishcooking_results,
remaining_hours,
update_residuals,
@@ -94,7 +95,6 @@ def __init__(self, db_name="fishtest_new"):
self.task_runs = []
self.task_duration = 900 # 15 minutes
- self.ltc_lower_bound = 40 # Beware: this is used as a filter in an index!
self.pt_info = {
"pt_version": "SF_15",
"pt_branch": "e6e324eb28fd49c1fc44b3b65784f85a773ec61c",
@@ -548,7 +548,7 @@ def get_finished_runs(
if username:
q["args.username"] = username
if ltc_only:
- q["tc_base"] = {"$gte": self.ltc_lower_bound}
+ q["tc_base"] = {"$gte": 20} # String comparison, SMP LTC is 20 th 8
if success_only:
q["is_green"] = True
if yellow_only:
@@ -558,11 +558,12 @@ def get_finished_runs(
q, skip=skip, limit=limit, sort=[("last_updated", DESCENDING)]
)
- count = self.runs.count_documents(q)
-
- # Don't show runs that were deleted
- runs_list = [run for run in c if not run.get("deleted")]
- return [runs_list, count]
+ if ltc_only:
+ predicate = lambda run: not run.get("deleted") and is_ltc(run)
+ else
+ predicate = lambda run: not run.get("deleted")
+ runs_list = list(filter(predicate, c))
+ return runs_list, len(runs_list)
def get_results(self, run, save_run=True):
if not run["results_stale"]:
diff --git a/server/fishtest/templates/run_table.mak b/server/fishtest/templates/run_table.mak
index 637ccb9e0..eca72b5a7 100644
--- a/server/fishtest/templates/run_table.mak
+++ b/server/fishtest/templates/run_table.mak
@@ -9,7 +9,7 @@
% endif
<%
- from fishtest.util import get_cookie, is_active_sprt_ltc
+ from fishtest.util import get_cookie, is_ltc
if toggle:
cookie_name = toggle+"_state"
%>
@@ -109,7 +109,7 @@
-
+
% if 'sprt' in run['args']:
sprt
% else:
diff --git a/server/fishtest/util.py b/server/fishtest/util.py
index b7339edcf..d4a950eaa 100644
--- a/server/fishtest/util.py
+++ b/server/fishtest/util.py
@@ -334,12 +334,9 @@ def get_tc_ratio(tc, threads=1, base="10+0.1"):
return threads * estimate_game_duration(tc) / estimate_game_duration(base)
-def is_active_sprt_ltc(run):
- return (
- not run["finished"]
- and "sprt" in run["args"]
- and get_tc_ratio(run["args"]["tc"], run["args"]["threads"]) > 4
- ) # SMP-STC ratio is 4
+def is_ltc(run):
+ # SMP-STC ratio is 4
+ return get_tc_ratio(run["args"]["tc"], run["args"].get("threads", 1)) > 4
def remaining_hours(run):
diff --git a/server/fishtest/views.py b/server/fishtest/views.py
index a69e82adc..0b0a69a28 100644
--- a/server/fishtest/views.py
+++ b/server/fishtest/views.py
@@ -19,6 +19,7 @@
format_results,
get_chi2,
get_hash,
+ is_ltc,
password_strength,
update_residuals,
)
@@ -885,7 +886,7 @@ def new_run_message(request, run):
if run["args"]["new_tc"] != run["args"]["tc"]
else ""
)
- ret += "(LTC)" if run["tc_base"] >= request.rundb.ltc_lower_bound else ""
+ ret += "(LTC)" if is_ltc(run) else ""
ret += f" Book:{run['args']['book']}"
ret += f" Threads:{run['args']['threads']}"
ret += "(SMP)" if run["args"]["threads"] > 1 else ""
diff --git a/server/utils/create_indexes.py b/server/utils/create_indexes.py
index 6e02fbfeb..2dbacd713 100644
--- a/server/utils/create_indexes.py
+++ b/server/utils/create_indexes.py
@@ -56,7 +56,7 @@ def create_runs_indexes():
("tc_base", DESCENDING),
],
name="finished_ltc_runs",
- partialFilterExpression={"finished": True, "tc_base": {"$gte": 40}},
+ partialFilterExpression={"finished": True, "tc_base": {"$gte": 20}}, # SMP LTC is 20 th 8
)
db["runs"].create_index(
[("args.username", DESCENDING), ("last_updated", DESCENDING)], name="user_runs"
|