Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions app/commands/progress/reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import sys
from datetime import datetime
from pathlib import Path

import click
import pytz
Expand Down Expand Up @@ -67,8 +68,21 @@ def reset() -> None:
# student has already created the sub-folder needed
rmtree(exercise_config.path / exercise_config.exercise_repo.repo_name)

if exercise_config.exercise_repo.repo_type != "ignore":
with ExercisesRepo() as repo:
with ExercisesRepo() as repo:
formatted_exercise_name = exercise_config.formatted_exercise_name

if len(exercise_config.base_files) > 0:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even repo_type ignore may have base files we want to restore to original state

info("Re-downloading exercise base files...")
for resource, path in exercise_config.base_files.items():
os.makedirs(Path(path).parent, exist_ok=True)
is_binary = Path(path).suffix in [".png", ".jpg", ".jpeg", ".gif"]
repo.download_file(
f"{formatted_exercise_name}/res/{resource}",
path,
is_binary,
)

if exercise_config.exercise_repo.repo_type != "ignore":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

setup_exercise_folder(repo, download_time, exercise_config)
info(
click.style(
Expand Down
Loading