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
003f17ef
Verified
Commit
003f17ef
authored
4 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Move append_if_all to util and add typing/docstring
parent
7ec9ca07
No related branches found
No related tags found
1 merge request
!73
Resolve "Add week select to week view"
Pipeline
#3268
passed
4 years ago
Stage: test
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/alsijil/util.py
+9
-0
9 additions, 0 deletions
aleksis/apps/alsijil/util.py
aleksis/apps/alsijil/views.py
+1
-5
1 addition, 5 deletions
aleksis/apps/alsijil/views.py
with
10 additions
and
5 deletions
aleksis/apps/alsijil/util.py
0 → 100644
+
9
−
0
View file @
003f17ef
from
typing
import
List
def
append_if_all
(
iterable
:
List
,
*
args
)
->
List
:
"""
Append args to a list if all args are true-like.
"""
if
all
(
args
):
for
a
in
args
:
iterable
.
append
(
a
)
return
iterable
This diff is collapsed.
Click to expand it.
aleksis/apps/alsijil/views.py
+
1
−
5
View file @
003f17ef
...
...
@@ -13,6 +13,7 @@ from django_tables2 import SingleTableView
from
reversion.views
import
RevisionMixin
from
rules.contrib.views
import
PermissionRequiredMixin
from
aleksis.apps.alsijil.util
import
append_if_all
from
aleksis.apps.chronos.managers
import
TimetableType
from
aleksis.apps.chronos.models
import
LessonPeriod
from
aleksis.apps.chronos.util.chronos_helpers
import
get_el_by_pk
...
...
@@ -294,11 +295,6 @@ def week_view(
lesson_periods
,
key
=
lambda
x
:
(
x
.
period
.
weekday
,
x
.
period
.
period
)
)
def
append_if_all
(
iterable
,
*
args
):
if
all
(
args
):
for
a
in
args
:
iterable
.
append
(
a
)
context
[
"
extra_marks
"
]
=
ExtraMark
.
objects
.
all
()
context
[
"
week
"
]
=
wanted_week
context
[
"
weeks
"
]
=
get_weeks_for_year
(
year
=
wanted_week
.
year
)
...
...
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