Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Chronos
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-App-Chronos
Commits
02c3f72d
Verified
Commit
02c3f72d
authored
3 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
[AutomaticPlan] Use all versions between the relevant revisions
parent
b2956a80
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!214
Resolve "AutomaticPlan doesn't look at versions between the last revision and the current revision"
Pipeline
#39194
passed
3 years ago
Stage: test
Stage: build
Stage: publish
Stage: docker
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/chronos/models.py
+10
-3
10 additions, 3 deletions
aleksis/apps/chronos/models.py
with
10 additions
and
3 deletions
aleksis/apps/chronos/models.py
+
10
−
3
View file @
02c3f72d
...
...
@@ -7,6 +7,7 @@ from datetime import date, datetime, time, timedelta
from
itertools
import
chain
from
typing
import
Any
,
Dict
,
Iterable
,
Iterator
,
List
,
Optional
,
Tuple
,
Union
from
django.contrib.contenttypes.models
import
ContentType
from
django.core.exceptions
import
ValidationError
from
django.core.files.base
import
ContentFile
,
File
from
django.core.files.storage
import
default_storage
...
...
@@ -55,7 +56,7 @@ from aleksis.apps.chronos.mixins import (
WeekAnnotationMixin
,
WeekRelatedMixin
,
)
from
aleksis.apps.chronos.util.change_tracker
import
substitutions_changed
from
aleksis.apps.chronos.util.change_tracker
import
_get_substitution_models
,
substitutions_changed
from
aleksis.apps.chronos.util.date
import
get_current_year
from
aleksis.apps.chronos.util.format
import
format_m2m
from
aleksis.apps.resint.models
import
LiveDocument
...
...
@@ -1206,12 +1207,18 @@ class AutomaticPlan(LiveDocument):
return
context
def
check_update
(
self
,
revision
:
Revision
,
versions
:
Iterable
[
Version
]
):
def
check_update
(
self
,
revision
:
Revision
):
"""
Check if the PDF file has to be updated and do the update then.
"""
if
not
self
.
last_substitutions_revision
or
(
self
.
last_substitutions_revision
!=
revision
and
revision
.
date_created
>
self
.
last_substitutions_revision
.
date_created
):
content_types
=
ContentType
.
objects
.
get_for_models
(
*
_get_substitution_models
()).
values
()
versions
=
Version
.
objects
.
filter
(
content_type__in
=
content_types
)
if
self
.
last_substitutions_revision
:
versions
=
versions
.
filter
(
revision__date_created__gt
=
self
.
last_substitutions_revision
.
date_created
)
update
=
False
for
version
in
versions
:
# Check if the changed object is relevant for the time period of the PDF file
...
...
@@ -1251,7 +1258,7 @@ class AutomaticPlan(LiveDocument):
def
automatic_plan_signal_receiver
(
sender
:
Revision
,
versions
:
Iterable
[
Version
],
**
kwargs
):
"""
Check all automatic plans for updates after substitutions changed.
"""
for
automatic_plan
in
AutomaticPlan
.
objects
.
all
():
automatic_plan
.
check_update
(
sender
,
versions
)
automatic_plan
.
check_update
(
sender
)
class
ChronosGlobalPermissions
(
GlobalPermissionModel
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment