Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Alsijil
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-Alsijil
Commits
bffed362
Verified
Commit
bffed362
authored
9 months ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Fix rules to use correct dates from Documentation calendar event
parent
d9e3d6db
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!360
Resolve "Add absence management to course book student dialog"
Pipeline
#189577
failed
9 months ago
Stage: prepare
Stage: test
Stage: build
Stage: publish
Stage: docker
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/alsijil/util/predicates.py
+4
-4
4 additions, 4 deletions
aleksis/apps/alsijil/util/predicates.py
with
4 additions
and
4 deletions
aleksis/apps/alsijil/util/predicates.py
+
4
−
4
View file @
bffed362
...
...
@@ -2,7 +2,7 @@ from typing import Any, Union
from
django.contrib.auth.models
import
User
from
django.db.models
import
Q
from
django.utils.timezone
import
localdate
,
localtime
from
django.utils.timezone
import
localdate
,
now
from
rules
import
predicate
...
...
@@ -481,11 +481,11 @@ def is_in_allowed_time_range(user: User, obj: Documentation):
get_site_preferences
()[
"
alsijil__allow_edit_future_documentations
"
]
==
"
all
"
or
(
get_site_preferences
()[
"
alsijil__allow_edit_future_documentations
"
]
==
"
current_day
"
and
obj
.
datetime
_start
.
date
()
<=
localdate
()
and
obj
.
value_start_
datetime
(
obj
)
.
date
()
<=
localdate
()
)
or
(
get_site_preferences
()[
"
alsijil__allow_edit_future_documentations
"
]
==
"
current_time
"
and
obj
.
datetime_start
<=
localtime
()
and
obj
.
value_start_datetime
(
obj
)
<=
now
()
)
):
return
True
...
...
@@ -495,6 +495,6 @@ def is_in_allowed_time_range(user: User, obj: Documentation):
@predicate
def
is_in_allowed_time_range_for_participation_status
(
user
:
User
,
obj
:
Documentation
):
"""
Predicate which checks if the documentation is in the allowed time range for editing.
"""
if
obj
and
obj
.
datetime_start
<=
localtime
():
if
obj
and
obj
.
value_start_datetime
(
obj
)
<=
now
():
return
True
return
False
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