feat: better release time default
All checks were successful
build / build (pull_request) Successful in 2m25s
build / build (push) Successful in 2m27s

This commit is contained in:
张泊明518370910136 2025-03-02 14:31:03 -05:00
parent 3e252e1ff0
commit 5444debb92
GPG Key ID: D47306D7062CDA9D
2 changed files with 10 additions and 15 deletions

View File

@ -1,5 +1,4 @@
import os import os
from datetime import datetime
from pathlib import Path from pathlib import Path
from typing import List from typing import List
@ -26,16 +25,8 @@ def convert(repo_conf: repo.Config, task_conf: task.Config) -> result.Config:
name=task_conf.task.name, name=task_conf.task.name,
# exact folder difference specified by type # exact folder difference specified by type
log_path=f"/home/tt/.cache/joj3/{task_conf.task.type_}.log", log_path=f"/home/tt/.cache/joj3/{task_conf.task.type_}.log",
expire_unix_timestamp=( expire_unix_timestamp=int(task_conf.release.end_time.timestamp()),
int(task_conf.release.end_time.timestamp()) effective_unix_timestamp=int(task_conf.release.begin_time.timestamp()),
if task_conf.release.end_time
else -1
),
effective_unix_timestamp=(
int(task_conf.release.begin_time.timestamp())
if task_conf.release.begin_time
else -1
),
actor_csv_path="/home/tt/.config/joj/students.csv", # students.csv position actor_csv_path="/home/tt/.config/joj/students.csv", # students.csv position
max_total_score=repo_conf.max_total_score, max_total_score=repo_conf.max_total_score,
stage=result.Stage( stage=result.Stage(
@ -74,6 +65,6 @@ def convert_joj1(joj1_conf: joj1.Config) -> task.Config:
task=task.Task( task=task.Task(
name=(""), name=(""),
), ),
release=task.Release(end_time=datetime.now(), begin_time=datetime.now()), release=task.Release(),
stages=stages, stages=stages,
) )

View File

@ -1,4 +1,4 @@
from datetime import datetime from datetime import datetime, timedelta
from pathlib import Path from pathlib import Path
from typing import Any, Dict, List, Type from typing import Any, Dict, List, Type
@ -113,8 +113,12 @@ class Stage(BaseModel):
class Release(BaseModel): class Release(BaseModel):
end_time: datetime = datetime.now() # RFC 3339 formatted date-time with offset end_time: datetime = datetime.now() + timedelta(
begin_time: datetime = datetime.now() # RFC 3339 formatted date-time with offset days=365
) # RFC 3339 formatted date-time with offset
begin_time: datetime = datetime.fromtimestamp(
0
) # RFC 3339 formatted date-time with offset
class Task(BaseModel): class Task(BaseModel):