Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nk20-scripts
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BDE
nk20-scripts
Commits
578bd892
Commit
578bd892
authored
4 years ago
by
ynerant
Browse files
Options
Downloads
Patches
Plain Diff
Move WEI scripts to the scripts app
parent
b9db26fa
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
management/commands/extract_ml_registrations.py
+53
-0
53 additions, 0 deletions
management/commands/extract_ml_registrations.py
management/commands/wei_algorithm.py
+16
-0
16 additions, 0 deletions
management/commands/wei_algorithm.py
with
69 additions
and
0 deletions
management/commands/extract_ml_registrations.py
0 → 100644
+
53
−
0
View file @
578bd892
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from
datetime
import
date
from
django.core.management
import
BaseCommand
from
django.db.models
import
Q
from
member.models
import
Membership
,
Club
from
wei.models
import
WEIClub
class
Command
(
BaseCommand
):
help
=
"
Get mailing list registrations from the last wei.
"
\
"
Usage: manage.py extract_ml_registrations -t {events,art,sport}.
"
\
"
You can write this into a file with a pipe, then paste the document into your mail manager.
"
def
add_arguments
(
self
,
parser
):
parser
.
add_argument
(
'
--type
'
,
'
-t
'
,
choices
=
[
"
members
"
,
"
clubs
"
,
"
events
"
,
"
art
"
,
"
sport
"
],
default
=
"
members
"
,
help
=
'
Select the type of the mailing list (default members)
'
)
parser
.
add_argument
(
'
--year
'
,
'
-y
'
,
type
=
int
,
default
=
None
,
help
=
'
Select the year of the concerned WEI. Default: last year
'
)
def
handle
(
self
,
*
args
,
**
options
):
if
options
[
"
type
"
]
==
"
members
"
:
for
membership
in
Membership
.
objects
.
filter
(
club__name
=
"
BDE
"
,
date_start__lte
=
date
.
today
(),
date_end__gte
=
date
.
today
(),
).
all
():
self
.
stdout
.
write
(
membership
.
user
.
email
)
return
if
options
[
"
type
"
]
==
"
clubs
"
:
for
club
in
Club
.
objects
.
all
():
self
.
stdout
.
write
(
club
.
email
)
return
if
options
[
"
year
"
]
is
None
:
wei
=
WEIClub
.
objects
.
order_by
(
'
-year
'
).
first
()
else
:
wei
=
WEIClub
.
objects
.
filter
(
year
=
options
[
"
year
"
])
if
wei
.
exists
():
wei
=
wei
.
get
()
else
:
wei
=
WEIClub
.
objects
.
order_by
(
'
-year
'
).
first
()
self
.
stderr
.
write
(
self
.
style
.
WARNING
(
"
Warning: there was no WEI in year
"
+
str
(
options
[
"
year
"
])
+
"
.
"
+
"
Assuming the last WEI (year
"
+
str
(
wei
.
year
)
+
"
)
"
))
q
=
Q
(
ml_events_registration
=
True
)
if
options
[
"
type
"
]
==
"
events
"
else
Q
(
ml_art_registration
=
True
)
\
if
options
[
"
type
"
]
==
"
art
"
else
Q
(
ml_sport_registration
=
True
)
registrations
=
wei
.
users
.
filter
(
q
)
for
registration
in
registrations
.
all
():
self
.
stdout
.
write
(
registration
.
user
.
email
)
This diff is collapsed.
Click to expand it.
management/commands/wei_algorithm.py
0 → 100644
+
16
−
0
View file @
578bd892
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from
django.core.management
import
BaseCommand
from
wei.forms
import
CurrentSurvey
class
Command
(
BaseCommand
):
help
=
"
Attribute to each first year member a bus for the WEI
"
def
handle
(
self
,
*
args
,
**
options
):
"""
Run the WEI algorithm to attribute a bus to each first year member.
"""
CurrentSurvey
.
get_algorithm_class
()().
run_algorithm
()
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