Rewrite some API on Event and ExtraLesson #433
No reviewers
Labels
No labels
Security
TeX
auto-update
board
done
board
ready
board
todo
check
delete-eslint-rc-js
check
update-builddeps-package-json
check
update-eslint-rc-js
check
update-gitignore
check
update-merge-request-template
check
update-prettier-ignore
check
update-pyproject-toml
check
update-renovate-json
check
update-tox-ini
part
backend
part
ci
part
docs
part
frontend
part
i18n
part
non-technical
part
packaging
prio
1
prio
2
prio
3
release-mr-5.x
size
large
size
medium
size
small
source
customer
source
customer::fsmw
source
customer::fss
source
customer::teckids
source
downstream
type
breaking
type
bug
type
feature
type
refactoring
workflow
blocked
workflow
confirmed
workflow
current-todo
workflow
discussing
workflow
new-app
workflow
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
aleksis/AlekSIS-App-Chronos!433
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/restructure-event-extra-lesson-api"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
mentioned in merge request AlekSIS-App-Alsijil!424
There is no linked issue and no description, and the commit message says absolutely nothing.
Why should the code be changed? Assuming you did not just change it for fun because you wanted to change some code, please describe what the intention is, at least in the commit message, and, ideally, also in the MR.
Looking at the code, it seems your commit also mixes a bugfix and a new feature. Please separate these.
Annotations are done in the
QuerySetusing theannotatemethod. While adding arbitrary attributes toModelinstances technically works, it will some day hit back when we think it is a real annotation (i.e. one the ORM is aware of) but it is a pure Python attribute.Firstly, if this method stays where it is, it should be renamed:
Methods starting with the
get_prefix are thought to be getter methods, which return an attribute of the current instance. Factories that generate an instance from another object start with thefrom_prefix only.But this also looks like it belongs into the
QuerySetor even manager.This needs proper commetnary.
(Now that this is practically a new method written by you, you have to add a docstring anyway ;).)
See above — annotations are the
QuerySet's job.Wat are these getters good for? They simply return a raw attribute…
Wat are these getters good for? They simply return a raw attribute…
Now I went through it until the end, it looks like the commit history should have even more logical steps.
marked this merge request as draft
Oh, sorry, of course this is actually still a draft. I missed to add "Draft:" in the title. All necessary information will follow.
added 2 commits
3d1e3660- Unify API methods of LessonPeriod, Event and ExtraLessonaec87faa- Add some API methods to access dates and periods for events and extra lessons betterCompare with previous version
They are necessary in order to have an unified API of getters on
LessonPeriod,EventandExtraLesson.Okay, I will use
from_periodas classmethod because it doesn't return a queryset but a singleTimePeriod.They are necessary in order to have an unified API of getters on
LessonPeriod,EventandExtraLesson.changed this line in version 3 of the diff
added 1 commit
4fe76e99- Fix type hints and add missing doc strings for improved API on ExtraLesson/Event/LessonPeriodCompare with previous version
added 1 commit
83c085b6- Rename get_from_period to from_period and add docstringCompare with previous version
marked this merge request as ready
We discussed this, and concluded that gettin the week into a model across a foreign key relation through a manager is non-trivial.
resolved all threads
mentioned in commit
abd5712123