diff --git a/aleksis/apps/alsijil/model_extensions.py b/aleksis/apps/alsijil/model_extensions.py index ecba9f773f54ba1343fbf86ab2cd2fc7003a760b..9e758d682d3f7f1ffc68df14b46cf92b6d0a6b3f 100644 --- a/aleksis/apps/alsijil/model_extensions.py +++ b/aleksis/apps/alsijil/model_extensions.py @@ -47,6 +47,7 @@ def mark_absent( week=wanted_week.week, defaults={"absent": absent, "excused": excused, "excuse_type": excuse_type}, ) + personal_note.groups_of_person.set(self.member_of.all()) if remarks: if personal_note.remarks: @@ -83,12 +84,14 @@ def get_personal_notes(self, wanted_week: CalendarWeek): ) # Create all missing personal notes - PersonalNote.objects.bulk_create( - [ - PersonalNote(person=person, lesson_period=self, week=wanted_week.week) - for person in missing_persons - ] - ) + new_personal_notes = [ + PersonalNote(person=person, lesson_period=self, week=wanted_week.week) + for person in missing_persons + ] + PersonalNote.objects.bulk_create(new_personal_notes) + + for personal_note in new_personal_notes: + personal_note.groups_of_person.set(personal_note.person.member_of.all()) return PersonalNote.objects.select_related("person").filter( lesson_period=self, week=wanted_week.week diff --git a/poetry.lock b/poetry.lock index a29392848f22c7352ecb3b4cf55ce2666436aa79..6869ab2867552636ad4b834e68ba13ca26fb47c9 100644 --- a/poetry.lock +++ b/poetry.lock @@ -68,7 +68,7 @@ extras = ["phonenumbers"] version = ">=3.0,<4.0" [package.dependencies.django-two-factor-auth] -extras = ["sms", "call", "phonenumbers", "yubikey"] +extras = ["yubikey", "call", "phonenumbers", "sms"] version = ">=1.11.0,<2.0.0" [package.dependencies.dynaconf] @@ -1103,6 +1103,14 @@ zipp = ">=0.5" docs = ["sphinx", "rst.linker"] testing = ["packaging", "pep517", "importlib-resources (>=1.3)"] +[[package]] +category = "dev" +description = "iniconfig: brain-dead simple config-ini parsing" +name = "iniconfig" +optional = false +python-versions = "*" +version = "1.0.1" + [[package]] category = "dev" description = "A Python utility / library to sort Python imports." @@ -1365,24 +1373,25 @@ description = "pytest: simple powerful testing with Python" name = "pytest" optional = false python-versions = ">=3.5" -version = "5.4.3" +version = "6.0.1" [package.dependencies] atomicwrites = ">=1.0" attrs = ">=17.4.0" colorama = "*" +iniconfig = "*" more-itertools = ">=4.0.0" packaging = "*" pluggy = ">=0.12,<1.0" -py = ">=1.5.0" -wcwidth = "*" +py = ">=1.8.2" +toml = "*" [package.dependencies.importlib-metadata] python = "<3.8" version = ">=0.12" [package.extras] -checkqa-mypy = ["mypy (v0.761)"] +checkqa_mypy = ["mypy (0.780)"] testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"] [[package]] @@ -1906,14 +1915,6 @@ brotli = ["brotlipy (>=0.6.0)"] secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "pyOpenSSL (>=0.14)", "ipaddress"] socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7,<2.0)"] -[[package]] -category = "dev" -description = "Measures the displayed width of unicode strings in a terminal" -name = "wcwidth" -optional = false -python-versions = "*" -version = "0.2.5" - [[package]] category = "main" description = "Character encoding aliases for legacy web content" @@ -1948,7 +1949,7 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] testing = ["jaraco.itertools", "func-timeout"] [metadata] -content-hash = "7d00a0fea6b654993db4ac9290d12a20122963db0ca9d96c2a642a82c8789c0d" +content-hash = "4345c57e5e3244ce0bbdc8ad8a7cffa385fe33b7da1b5fc87ffe32dabf45c5a9" python-versions = "^3.7" [metadata.files] @@ -2320,6 +2321,10 @@ importlib-metadata = [ {file = "importlib_metadata-1.7.0-py2.py3-none-any.whl", hash = "sha256:dc15b2969b4ce36305c51eebe62d418ac7791e9a157911d58bfb1f9ccd8e2070"}, {file = "importlib_metadata-1.7.0.tar.gz", hash = "sha256:90bb658cdbbf6d1735b6341ce708fc7024a3e14e99ffdc5783edea9f9b077f83"}, ] +iniconfig = [ + {file = "iniconfig-1.0.1-py3-none-any.whl", hash = "sha256:80cf40c597eb564e86346103f609d74efce0f6b4d4f30ec8ce9e2c26411ba437"}, + {file = "iniconfig-1.0.1.tar.gz", hash = "sha256:e5f92f89355a67de0595932a6c6c02ab4afddc6fcdc0bfc5becd0d60884d3f69"}, +] isort = [ {file = "isort-5.2.2-py3-none-any.whl", hash = "sha256:aea484023188ef1c38256dd24afa96e914adafe3a911a1786800a74e433006d1"}, {file = "isort-5.2.2.tar.gz", hash = "sha256:96b27045e3187b9bdde001143b79f9b10a462f372bff7062302818013b6c86f3"}, @@ -2541,8 +2546,8 @@ pyparsing = [ {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"}, ] pytest = [ - {file = "pytest-5.4.3-py3-none-any.whl", hash = "sha256:5c0db86b698e8f170ba4582a492248919255fcd4c79b1ee64ace34301fb589a1"}, - {file = "pytest-5.4.3.tar.gz", hash = "sha256:7979331bfcba207414f5e1263b5a0f8f521d0f457318836a7355531ed1a4c7d8"}, + {file = "pytest-6.0.1-py3-none-any.whl", hash = "sha256:8b6007800c53fdacd5a5c192203f4e531eb2a1540ad9c752e052ec0f7143dbad"}, + {file = "pytest-6.0.1.tar.gz", hash = "sha256:85228d75db9f45e06e57ef9bf4429267f81ac7c0d742cc9ed63d09886a9fe6f4"}, ] pytest-cov = [ {file = "pytest-cov-2.10.0.tar.gz", hash = "sha256:1a629dc9f48e53512fcbfda6b07de490c374b0c83c55ff7a1720b3fccff0ac87"}, @@ -2767,10 +2772,6 @@ urllib3 = [ {file = "urllib3-1.25.10-py2.py3-none-any.whl", hash = "sha256:e7983572181f5e1522d9c98453462384ee92a0be7fac5f1413a1e35c56cc0461"}, {file = "urllib3-1.25.10.tar.gz", hash = "sha256:91056c15fa70756691db97756772bb1eb9678fa585d9184f24534b100dc60f4a"}, ] -wcwidth = [ - {file = "wcwidth-0.2.5-py2.py3-none-any.whl", hash = "sha256:beb4802a9cebb9144e99086eff703a642a13d6a0052920003a230f3294bbe784"}, - {file = "wcwidth-0.2.5.tar.gz", hash = "sha256:c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83"}, -] webencodings = [ {file = "webencodings-0.5.1-py2.py3-none-any.whl", hash = "sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78"}, {file = "webencodings-0.5.1.tar.gz", hash = "sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923"}, diff --git a/pyproject.toml b/pyproject.toml index 7bb02c5ef816691842b98cf26b7dceffc58fced2..2a341597ebd03a855ebb772111a6005b8fb75cc1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ sphinx = "^3.0" sphinxcontrib-django = "^0.5.0" sphinx-autodoc-typehints = "^1.7" django-stubs = "^1.1" -pytest = "^5.3" +pytest = "^6.0" pytest-django = "^3.7" pytest-django-testing-postgresql = "^0.1" selenium = "^3.141.0"