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

Laufende Nummer in den Form Elementen #64

Merged
merged 8 commits into from
Jan 15, 2024
Merged

Conversation

alexanderschmitz
Copy link
Contributor

@alexanderschmitz alexanderschmitz commented Dec 5, 2023

Siehe PR 43

Außerdem:

  • refactoring: Logik wird aus den Jinja2 templates verschoben (besseres Debugging, Fehlervermeidung, Typing, ...)

  • Möglichkeit in Zukunft die contextualize Methoden zu erweitern.

  • ref: Plugin Issue 38

@MartinGauk MartinGauk requested review from MHajoha and removed request for MHajoha December 8, 2023 10:13
- ref: questionpy-org/moodle-qtype_questionpy#38
- removes as much logic from the jinja forms as possible
- allows {qpy:repno} to be replaced with the current repetition number
- missing context in creation of CxdGroupElement
- missing contextualization for CxdSelectElement
- added identifier in the example
@alexanderschmitz alexanderschmitz marked this pull request as ready for review December 12, 2023 10:33
@MHajoha
Copy link
Member

MHajoha commented Jan 8, 2024

Wäre es nicht einfacher (und wesentlich kürzer), das in den Jinja-Templates zu lösen? Also aus create_repetition die laufende Nummer bzw. ein dict mit Kontextvariable(n) durch die verschiedenen Makros in die Elemente zu schleifen, und dort label und co. entsprechend zu bearbeiten?

@alexanderschmitz
Copy link
Contributor Author

Aktuell wäre es einfacher das in den Templates zu lösen, aber ich denke für die Zukunft ist es leichter, wenn weniger Logik in den Templates liegt. Ich hab das jetzt schon öfter gemerkt, dass ein Refactoring der Templates fehleranfällig ist. Ich denke, dass das einführen von neuen Kontextvariablen so leichter ist.

questionpy_sdk/webserver/context.py Outdated Show resolved Hide resolved
questionpy_sdk/webserver/context.py Outdated Show resolved Hide resolved
questionpy_sdk/webserver/elements.py Outdated Show resolved Hide resolved
questionpy_sdk/webserver/context.py Outdated Show resolved Hide resolved
questionpy_sdk/webserver/elements.py Outdated Show resolved Hide resolved
questionpy_sdk/webserver/elements.py Outdated Show resolved Hide resolved
tests/webserver/test_context.py Outdated Show resolved Hide resolved
@MHajoha
Copy link
Member

MHajoha commented Jan 9, 2024

Fast vergessen: Im Moodle-Plugin fangen die Nummern bei 1 an. Das halte ich hier auch für sinnvoller

- includes other requested changes from the PR
questionpy_sdk/webserver/elements.py Outdated Show resolved Hide resolved
questionpy_sdk/webserver/elements.py Outdated Show resolved Hide resolved
questionpy_sdk/webserver/elements.py Outdated Show resolved Hide resolved
@MartinGauk MartinGauk merged commit ba73643 into dev Jan 15, 2024
7 checks passed
@MartinGauk MartinGauk deleted the feat/repetition-number branch January 15, 2024 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants