Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor 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-Core
Commits
43646b16
Verified
Commit
43646b16
authored
4 years ago
by
Tom Teichler
Browse files
Options
Downloads
Patches
Plain Diff
Make lint clean
parent
07a84ad4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#4672
passed
4 years ago
Stage: test
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/core/models.py
+7
-7
7 additions, 7 deletions
aleksis/core/models.py
with
7 additions
and
7 deletions
aleksis/core/models.py
+
7
−
7
View file @
43646b16
...
...
@@ -226,9 +226,9 @@ class Person(ExtensibleModel):
def
age_at
(
self
,
today
):
if
self
.
date_of_birth
:
years
=
today
.
year
-
self
.
date_of_birth
.
year
if
(
self
.
date_of_birth
.
month
>
today
.
month
or
(
self
.
date_of_birth
.
month
==
today
.
month
and
self
.
date_of_birth
.
day
>
today
.
day
)
):
if
self
.
date_of_birth
.
month
>
today
.
month
or
(
self
.
date_of_birth
.
month
==
today
.
month
and
self
.
date_of_birth
.
day
>
today
.
day
):
years
-=
1
return
years
...
...
@@ -388,14 +388,14 @@ class Group(SchoolTermRelatedExtensibleModel):
"""
Get stats about a given group
"""
stats
=
{}
stats
[
'
members
'
]
=
len
(
self
.
members
.
all
())
stats
[
"
members
"
]
=
len
(
self
.
members
.
all
())
ages
=
[
person
.
age
for
person
in
self
.
members
.
filter
(
date_of_birth__isnull
=
False
)]
if
ages
:
stats
[
'
age_avg
'
]
=
sum
(
ages
)
/
len
(
ages
)
stats
[
'
age_range_min
'
]
=
min
(
ages
)
stats
[
'
age_range_max
'
]
=
max
(
ages
)
stats
[
"
age_avg
"
]
=
sum
(
ages
)
/
len
(
ages
)
stats
[
"
age_range_min
"
]
=
min
(
ages
)
stats
[
"
age_range_max
"
]
=
max
(
ages
)
return
stats
...
...
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