-
Notifications
You must be signed in to change notification settings - Fork 59
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
Add run-on to Boefje Setup page #4061
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
fe7415c
Add run_on to Boefje in katalogus
madelondohmen 828caa9
Add run_on to boefje setup page (with js)
madelondohmen 3a0e410
Show run_on on boefje detail page
madelondohmen 18fd80d
Fixes for all edge cases
madelondohmen dd6ba80
Merge branch 'main' into feature/boefje-variants-run-on-
madelondohmen b48de4d
Update translations
madelondohmen b3c009d
Merge branch 'feature/boefje-variants-run-on-' of https://github.com/…
madelondohmen ccd2762
Code fixes
madelondohmen 0413dae
- Create enum out of run_on, suggested "all" instead of "create_updat…
Donnype 0cd530f
- Separate RunOn into RunOnDB and RunOn
Donnype cafa536
Fixes in frontend for RunOn
madelondohmen b12b15a
Make run_on in mula a list[RunOn]
madelondohmen 279f313
Update boefjes/boefjes/sql/db_models.py
madelondohmen fbc973d
Update boefjes/boefjes/models.py
madelondohmen 99d7182
Merge branch 'main' into feature/boefje-variants-run-on-
madelondohmen 46174e6
Pre-commit fix
madelondohmen 4f8b54d
Update form.scss
underdarknl 3576352
Update and rename boefjeScanTypeToggler.js to choiceToggle.js
underdarknl 074a903
Update boefje_setup.html
underdarknl df52061
Update boefje.py
underdarknl ff8c94e
Update boefje_setup.py
underdarknl f94216f
Update boefje.py
underdarknl 265eee5
Merge branch 'main' into feature/boefje-variants-run-on-
underdarknl 9b3a94e
Update choiceToggle.js
underdarknl 5f624e3
Update boefje.py
underdarknl b264a3b
Update choiceToggle.js
underdarknl f1e937e
Merge branch 'main' into feature/boefje-variants-run-on-
underdarknl 8957770
Update choiceToggle.js
underdarknl 4c32471
refactor some duplicate code in boefje_setup.py
underdarknl be6af11
I was a little too eager.
underdarknl c3ab124
Update boefje_setup.py
underdarknl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
boefjes/boefjes/migrations/versions/fc0295b38184_add_run_on_field_to_boefje.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
"""Add run on field to boefje | ||
Revision ID: fc0295b38184 | ||
Revises: 9f48560b0000 | ||
Create Date: 2025-02-04 16:43:59.171960 | ||
""" | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "fc0295b38184" | ||
down_revision = "9f48560b0000" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
run_on = sa.Enum("create", "update", "create_update", name="run_on") | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
run_on.create(op.get_bind()) | ||
op.add_column("boefje", sa.Column("run_on", run_on, nullable=True)) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_column("boefje", "run_on") | ||
run_on.drop(op.get_bind(), checkfirst=False) | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from boefjes.models import RunOn | ||
from boefjes.sql.db_models import RunOnDB | ||
|
||
|
||
def test_run_on(): | ||
assert RunOnDB.from_run_ons([RunOn.CREATE]) == RunOnDB.CREATE | ||
assert RunOnDB.from_run_ons([RunOn.UPDATE]) == RunOnDB.UPDATE | ||
assert RunOnDB.from_run_ons([RunOn.CREATE, RunOn.UPDATE]) == RunOnDB.CREATE_UPDATE | ||
assert RunOnDB.from_run_ons([RunOn.UPDATE, RunOn.CREATE]) == RunOnDB.CREATE_UPDATE | ||
assert RunOnDB.from_run_ons([1]) is None | ||
assert RunOnDB.from_run_ons([]) is None | ||
|
||
assert RunOnDB.CREATE.to_run_ons() == [RunOn.CREATE] | ||
assert RunOnDB.UPDATE.to_run_ons() == [RunOn.UPDATE] | ||
assert RunOnDB.CREATE_UPDATE.to_run_ons() == [RunOn.CREATE, RunOn.UPDATE] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@madelondohmen This should be
Self
from typing_extensions (probably) it should actually returnRunOnDB | None
which won't work because it references itself.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Donnype is right. "RunOn | None" won't work since it returns a RunOnDB. But Self doesn't work as well. So I suggest to leave it as it was.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typing.Self
is introduced in Python 3.11, but we still use 3.10 for development. Therefore:def from_run_ons(cls, run_ons: list[RunOn] | None) -> "RunOnDB" | None: