Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make xopp a config setting #56

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ PDF feedback you can use whichever tool you like, and overwrite the `.pdf.todo`
placeholder with the resulting output. If this tool adds files to the feedback
directory that you do not want to send to the students, you can add their
endings to the config file under the `ignore_feedback_suffix` key. Marking with
Xournal++ is supported by default: Simply add the flag `-x` to the `init`
command above to automatically create the relevant `.xopp` files.
Xournal++ is supported by default: Simply set the value of the `xopp` key in
the config file to `true` to automatically create the relevant `.xopp` files.

While writing the feedback, you can keep track of the points the teams get in
the file `points.json`. In the case of plagiarism, write `Plagiarism` in the
Expand All @@ -184,9 +184,9 @@ match up. A json file containing the individual points per student is also
generated.

In case you need make changes to the markings and rerun the collection step, use
the `-r` flag to overwrite existing feedback archives. If you are using
Xournal++, you can also use the `-x` flag here to automatically export the
`.xopp` files before collecting the feedback.
the `-r` flag to overwrite existing feedback archives. If you use
Xournal++, the `.xopp` files will be exported automatically before collecting
the feedback if the value of the `xopp` key in the config file is set to `true`.

### combine
This command is only relevant for the `exercise` marking mode.
Expand Down Expand Up @@ -238,6 +238,10 @@ LibreOffice. To access this command:
`smtp-ext` setup)
- `smtp_user`: SMTP user, empty by default (use your short unibas account name
for an `smtp-ext` setup)
- `xopp`: if you use Xournal++ for marking, set the value to `true`; the
relevant `xopp` files are then automatically created with the `init`
subcommand and exported with the `collect` subcommand before the feedback
is collected.
- `ignore_feedback_suffix`: a list of extensions that should be ignored by the
`collect` sub-command; this is useful if the tools you use for marking create
files in the feedback folders that you don't want to send to the students
Expand Down
7 changes: 3 additions & 4 deletions krummstab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,7 @@ def collect_feedback_files(submission: submissions.Submission,

if not feedback_files:
logging.critical(
f"Feedback archive for team {submission.root_dir.name} is empty! "
"Did you forget the '-x' flag to export .xopp files?"
f"Feedback archive for team {submission.root_dir.name} is empty!"
)

# If there is exactly one pdf in the feedback directory, we do not need to
Expand Down Expand Up @@ -782,7 +781,7 @@ def collect(_the_config: config.Config, args) -> None:
delete_collected_feedback_directories(sheet)
else:
logging.critical("Aborting 'collect' without overwriting existing collected feedback.")
if args.xopp:
if _the_config.xopp:
export_xopp_files(sheet)
create_collected_feedback_directories(sheet)
for submission in sheet.get_relevant_submissions():
Expand Down Expand Up @@ -1380,7 +1379,7 @@ def init(_the_config: config.Config, args) -> None:
# . └── submission.json
# ├── sheet.json
# └── points.json
if args.xopp:
if _the_config.xopp:
generate_xopp_files(sheet)


Expand Down
14 changes: 0 additions & 14 deletions krummstab/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,6 @@ def add_init_command_parser(subparsers):
type=int,
help="the exercises you have to mark",
)
parser_init.add_argument(
"-x",
"--xopp",
action=argparse.BooleanOptionalAction,
default=False,
help="generate .xopp files",
)
return parser_init


Expand All @@ -111,13 +104,6 @@ def add_collect_command_parser(subparsers):
"collect",
help="collect feedback files after marking is done",
)
parser_collect.add_argument(
"-x",
"--xopp",
action=argparse.BooleanOptionalAction,
default=False,
help="export .xopp files",
)
parser_collect.add_argument(
"sheet_root_dir",
type=pathlib.Path,
Expand Down
4 changes: 4 additions & 0 deletions krummstab/schemas/config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@
"smtp_user": {
"type": "string"
},
"xopp": {
"type": "boolean"
},
"ignore_feedback_suffix": {
"type": "array",
"items": {
Expand All @@ -153,6 +156,7 @@
"smtp_url",
"smtp_port",
"smtp_user",
"xopp",
"ignore_feedback_suffix"
],
"if": {
Expand Down
1 change: 1 addition & 0 deletions tests/config-individual.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"smtp_url": "smtp.unibas.ch",
"smtp_port": 25,
"smtp_user": "",
"xopp": false,
"ignore_feedback_suffix": [ ".xopp" ]
}
Loading