Skip to content

Commit

Permalink
consistent "LTC:" addition
Browse files Browse the repository at this point in the history
  • Loading branch information
peregrineshahin committed Jul 3, 2024
1 parent f569e94 commit 0594b37
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
10 changes: 6 additions & 4 deletions server/fishtest/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,14 +350,16 @@ 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):
def is_sprt_ltc_data(args):
return (
not run["finished"]
and "sprt" in run["args"]
and get_tc_ratio(run["args"]["tc"], run["args"]["threads"]) > 4
"sprt" in args and get_tc_ratio(args["tc"], args["threads"]) > 4
) # SMP-STC ratio is 4


def is_active_sprt_ltc(run):
return not run["finished"] and is_sprt_ltc_data(run["args"])


def format_date(date):
if not date or date == "Unknown":
return "Unknown"
Expand Down
7 changes: 4 additions & 3 deletions server/fishtest/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
get_hash,
get_tc_ratio,
github_repo_valid,
is_sprt_ltc_data,
password_strength,
update_residuals,
)
Expand Down Expand Up @@ -965,9 +966,7 @@ def strip_message(m):
"This commit has no signature: please supply it manually."
)
if len(data["info"]) == 0:
data["info"] = (
"" if re.match(r"^[012]?[0-9][^0-9].*", data["tc"]) else "LTC: "
) + strip_message(c["commit"]["message"])
data["info"] = strip_message(c["commit"]["message"])

# Check that the book exists in the official books repo
if len(data["book"]) > 0:
Expand Down Expand Up @@ -1194,6 +1193,8 @@ def tests_run(request):
if request.method == "POST":
try:
data = validate_form(request)
if is_sprt_ltc_data(data):
data["info"] = "LTC: " + data["info"]
run_id = request.rundb.new_run(**data)
run = request.rundb.get_run(run_id)
request.actiondb.new_run(
Expand Down

0 comments on commit 0594b37

Please sign in to comment.