fix: remove late file
This commit is contained in:
parent
ec3346b9ba
commit
48e67985d2
|
@ -54,14 +54,12 @@ class Canvas:
|
||||||
if "_" not in file_name:
|
if "_" not in file_name:
|
||||||
continue
|
continue
|
||||||
segments = file_name.split("_")
|
segments = file_name.split("_")
|
||||||
is_late = False
|
|
||||||
if segments[1] == "late":
|
if segments[1] == "late":
|
||||||
file_id = int(segments[2])
|
file_id = int(segments[2])
|
||||||
student = first(
|
student = first(
|
||||||
self.students, lambda x: x.login_id == login_ids[file_id]
|
self.students, lambda x: x.login_id == login_ids[file_id]
|
||||||
)
|
)
|
||||||
logger.info(f"{student} submits late")
|
logger.info(f"{student} submits late")
|
||||||
is_late = True
|
|
||||||
else:
|
else:
|
||||||
file_id = int(segments[1])
|
file_id = int(segments[1])
|
||||||
target_dir = os.path.join(dir, login_ids[file_id])
|
target_dir = os.path.join(dir, login_ids[file_id])
|
||||||
|
@ -70,8 +68,6 @@ class Canvas:
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
except PatoolError:
|
except PatoolError:
|
||||||
os.rename(path, os.path.join(target_dir, file_name))
|
os.rename(path, os.path.join(target_dir, file_name))
|
||||||
if is_late:
|
|
||||||
open(os.path.join(target_dir, "SUBMIT_LATE"), mode="w")
|
|
||||||
if create_score_file:
|
if create_score_file:
|
||||||
open(os.path.join(target_dir, self.score_filename), mode="w")
|
open(os.path.join(target_dir, self.score_filename), mode="w")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user