Skip to content

Commit

Permalink
Added suffixes to the student and solution files within the folder (t…
Browse files Browse the repository at this point in the history
…o avoid confusion)
  • Loading branch information
dominik-probst committed May 6, 2024
1 parent 60671b3 commit 2114a81
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion exercise/create_exercise_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,14 @@ def create_additional_files_zip(input_folder, output_folder, style):
new_file.write(new_notebook[0])

# Create a zip out of the copied (and modified) folder
shutil.make_archive(output_folder + "/Additional-Files", "zip", folder_temp_path)
if style == "student":
shutil.make_archive(
output_folder + "/Additional-Files-Student", "zip", folder_temp_path
)
elif style == "solution":
shutil.make_archive(
output_folder + "/Additional-Files-Solution", "zip", folder_temp_path
)


# Helper function to compile the LaTeX files
Expand Down Expand Up @@ -129,6 +136,18 @@ def compile_latex_files(input, output_folder, style):
print("Error while creating the LaTeX files.")
print("Error:", result.stderr.decode())

# Rename the output pdf to include a -Student or -Solution suffix
if style == "student":
os.rename(
os.path.join(temp_folder, input + ".pdf"),
os.path.join(temp_folder, input + "-Student.pdf"),
)
elif style == "solution":
os.rename(
os.path.join(temp_folder, input + ".pdf"),
os.path.join(temp_folder, input + "-Solution.pdf"),
)

# Copy the pdf from the temp folder to the output folder
shutil.copy(os.path.join(temp_folder, input + ".pdf"), output_folder)

Expand Down

0 comments on commit 2114a81

Please sign in to comment.