mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-27 11:58:54 +02:00
Compare commits
18 Commits
nix-shell
...
95e07f3148
Author | SHA1 | Date | |
---|---|---|---|
95e07f3148 | |||
770c748bd9 | |||
06fa096405 | |||
182f680507 | |||
84b16ab603 | |||
6a1b51dbbf | |||
c441a43a8b | |||
87f3b51b04 | |||
0a853fd3e6 | |||
c429734810 | |||
5d759111b6 | |||
70baf7566c | |||
eb355f547c | |||
7068170f18 | |||
45ee9a8941 | |||
454ea19603 | |||
5ceda66ded | |||
6443d64b69 |
@ -1,6 +1,8 @@
|
|||||||
# Copyright (C) 2018-2021 by BDE ENS Paris-Saclay
|
# Copyright (C) 2018-2021 by BDE ENS Paris-Saclay
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
@ -75,6 +77,9 @@ def get_row_class(record):
|
|||||||
c += " table-info"
|
c += " table-info"
|
||||||
elif record.note.balance < 0:
|
elif record.note.balance < 0:
|
||||||
c += " table-danger"
|
c += " table-danger"
|
||||||
|
#MODE VIEUXCON=ON
|
||||||
|
if (datetime.datetime.utcnow().timestamp() - record.note.created_at.timestamp()) > 3600*24*365*3:
|
||||||
|
c += " font-weight-bold"
|
||||||
return c
|
return c
|
||||||
|
|
||||||
|
|
||||||
|
@ -223,12 +223,13 @@ class ActivityEntryView(LoginRequiredMixin, TemplateView):
|
|||||||
# Keep only users that have a note
|
# Keep only users that have a note
|
||||||
note_qs = note_qs.filter(note__noteuser__isnull=False)
|
note_qs = note_qs.filter(note__noteuser__isnull=False)
|
||||||
|
|
||||||
# Keep only members
|
# if activity.activity_type.name != "Pot Vieux":
|
||||||
note_qs = note_qs.filter(
|
# # Keep only members
|
||||||
note__noteuser__user__memberships__club=activity.attendees_club,
|
# note_qs = note_qs.filter(
|
||||||
note__noteuser__user__memberships__date_start__lte=timezone.now(),
|
# note__noteuser__user__memberships__club=activity.attendees_club,
|
||||||
note__noteuser__user__memberships__date_end__gte=timezone.now(),
|
# note__noteuser__user__memberships__date_start__lte=timezone.now(),
|
||||||
)
|
# note__noteuser__user__memberships__date_end__gte=timezone.now(),
|
||||||
|
# )
|
||||||
|
|
||||||
# Filter with permission backend
|
# Filter with permission backend
|
||||||
note_qs = note_qs.filter(PermissionBackend.filter_queryset(self.request, Alias, "view"))
|
note_qs = note_qs.filter(PermissionBackend.filter_queryset(self.request, Alias, "view"))
|
||||||
|
5
apps/api/pagination.py
Normal file
5
apps/api/pagination.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
from rest_framework.pagination import PageNumberPagination
|
||||||
|
|
||||||
|
class CustomPagination(PageNumberPagination):
|
||||||
|
page_size_query_param = 'page_size'
|
||||||
|
|
@ -1967,7 +1967,7 @@
|
|||||||
"note",
|
"note",
|
||||||
"transaction"
|
"transaction"
|
||||||
],
|
],
|
||||||
"query": "[\"AND\", [\"OR\", {\"source\": [\"club\", \"note\"]}, {\"destination\": [\"club\", \"note\"]}], [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 5000]}, \"valid\": true}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 5000]}, \"valid\": false}]]",
|
"query": "[\"AND\", [\"OR\", {\"source\": [\"club\", \"note\"]}, {\"destination\": [\"club\", \"note\"]}], [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 5000]}, \"valid\": false}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 5000]}, \"valid\": true}]]",
|
||||||
"type": "change",
|
"type": "change",
|
||||||
"mask": 2,
|
"mask": 2,
|
||||||
"field": "valid",
|
"field": "valid",
|
||||||
@ -2607,7 +2607,7 @@
|
|||||||
"note",
|
"note",
|
||||||
"transaction"
|
"transaction"
|
||||||
],
|
],
|
||||||
"query": "[\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 5000]}, \"valid\": true}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 5000]}, \"valid\": false}]",
|
"query": "[\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 5000]}, \"valid\": false}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 5000]}, \"valid\": true}]",
|
||||||
"type": "change",
|
"type": "change",
|
||||||
"mask": 2,
|
"mask": 2,
|
||||||
"field": "valid",
|
"field": "valid",
|
||||||
@ -2623,7 +2623,7 @@
|
|||||||
"note",
|
"note",
|
||||||
"transaction"
|
"transaction"
|
||||||
],
|
],
|
||||||
"query": "[\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 5000]}, \"valid\": true}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 5000]}, \"valid\": false}]",
|
"query": "[\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 5000]}, \"valid\": false}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 5000]}, \"valid\": true}]",
|
||||||
"type": "change",
|
"type": "change",
|
||||||
"mask": 2,
|
"mask": 2,
|
||||||
"field": "invalidity_reason",
|
"field": "invalidity_reason",
|
||||||
|
Submodule apps/scripts updated: 86bc2d2698...f580f9b9e9
@ -310,8 +310,8 @@ class SogeCredit(models.Model):
|
|||||||
amount = sum(transaction.total for transaction in self.transactions.all())
|
amount = sum(transaction.total for transaction in self.transactions.all())
|
||||||
if 'wei' in settings.INSTALLED_APPS:
|
if 'wei' in settings.INSTALLED_APPS:
|
||||||
from wei.models import WEIMembership
|
from wei.models import WEIMembership
|
||||||
if not WEIMembership.objects.filter(club__weiclub__year=datetime.date.today().year, user=self.user)\
|
if not WEIMembership.objects\
|
||||||
.exists():
|
.filter(club__weiclub__year=self.credit_transaction.created_at.year, user=self.user).exists():
|
||||||
# 80 € for people that don't go to WEI
|
# 80 € for people that don't go to WEI
|
||||||
amount += 8000
|
amount += 8000
|
||||||
return amount
|
return amount
|
||||||
@ -329,17 +329,18 @@ class SogeCredit(models.Model):
|
|||||||
bde_qs = Membership.objects.filter(user=self.user, club=bde, date_start__gte=bde.membership_start)
|
bde_qs = Membership.objects.filter(user=self.user, club=bde, date_start__gte=bde.membership_start)
|
||||||
kfet_qs = Membership.objects.filter(user=self.user, club=kfet, date_start__gte=kfet.membership_start)
|
kfet_qs = Membership.objects.filter(user=self.user, club=kfet, date_start__gte=kfet.membership_start)
|
||||||
|
|
||||||
if bde_qs.exists():
|
## Soge do not pay BDE and kfet memberships this year (2022-2023)
|
||||||
m = bde_qs.get()
|
# if bde_qs.exists():
|
||||||
if MembershipTransaction.objects.filter(membership=m).exists(): # non-free membership
|
# m = bde_qs.get()
|
||||||
if m.transaction not in self.transactions.all():
|
# if MembershipTransaction.objects.filter(membership=m).exists(): # non-free membership
|
||||||
self.transactions.add(m.transaction)
|
# if m.transaction not in self.transactions.all():
|
||||||
|
# self.transactions.add(m.transaction)
|
||||||
if kfet_qs.exists():
|
#
|
||||||
m = kfet_qs.get()
|
# if kfet_qs.exists():
|
||||||
if MembershipTransaction.objects.filter(membership=m).exists(): # non-free membership
|
# m = kfet_qs.get()
|
||||||
if m.transaction not in self.transactions.all():
|
# if MembershipTransaction.objects.filter(membership=m).exists(): # non-free membership
|
||||||
self.transactions.add(m.transaction)
|
# if m.transaction not in self.transactions.all():
|
||||||
|
# self.transactions.add(m.transaction)
|
||||||
|
|
||||||
if 'wei' in settings.INSTALLED_APPS:
|
if 'wei' in settings.INSTALLED_APPS:
|
||||||
from wei.models import WEIClub
|
from wei.models import WEIClub
|
||||||
|
@ -14,14 +14,17 @@ from .base import WEISurvey, WEISurveyInformation, WEISurveyAlgorithm, WEIBusInf
|
|||||||
from ...models import WEIMembership
|
from ...models import WEIMembership
|
||||||
|
|
||||||
WORDS = [
|
WORDS = [
|
||||||
'13 organisé', '3ième mi temps', 'Années 2000', 'Apéro', 'BBQ', 'BP', 'Beauf', 'Binge drinking', 'Bon enfant',
|
'ABBA', 'After', 'Alcoolique anonyme', 'Ambiance festive', 'Années 2000', 'Apéro', 'Art',
|
||||||
'Cartouche', 'Catacombes', 'Chansons paillardes', 'Chansons populaires', 'Chanteur', 'Chartreuse', 'Chill',
|
'Baby foot billard biere pong', 'BBQ', 'Before', 'Bière pong', 'Bon enfant', 'Calme', 'Canapé',
|
||||||
'Core', 'DJ', 'Dancefloor', 'Danse', 'David Guetta', 'Disco', 'Eau de vie', 'Électro', 'Escalade', 'Familial',
|
'Chanson paillarde', 'Chanson populaire', 'Chartreuse', 'Cheerleader', 'Chill', 'Choré',
|
||||||
'Fanfare', 'Fracassage', 'Féria', 'Hard rock', 'Hoeggarden', 'House', 'Huit-six', 'IPA', 'Inclusif', 'Inferno',
|
'Cinéma', 'Cocktail', 'Comédie musicle', 'Commercial', 'Copaing', 'Danse', 'Dancefloor',
|
||||||
'Introverti', 'Jager bomb', 'Jazz', 'Jeux d\'alcool', 'Jeux de rôles', 'Jeux vidéo', 'Jul', 'Jus de fruit',
|
'Electro', 'Fanfare', 'Gin tonic', 'Inclusif', 'Jazz', "Jeux d'alcool", 'Jeux de carte',
|
||||||
'Karaoké', 'LGBTQI+', 'Lady Gaga', 'Loup garou', 'Morning beer', 'Métal', 'Nuit blanche', 'Ovalie', 'Psychedelic',
|
'Jeux de rôle', 'Jeux de société', 'JUL', 'Jus de fruit', 'Kfet', 'Kleptomanie assurée',
|
||||||
'Pétanque', 'Rave', 'Reggae', 'Rhum', 'Ricard', 'Rock', 'Rosé', 'Rétro', 'Séducteur', 'Techno', 'Thérapie taxi',
|
'LGBTQ+', 'Livre', 'Morning beer', 'Musique', 'NAPS', 'Paillettes', 'Pastis', 'Paté Hénaff',
|
||||||
'Théâtre', 'Trap', 'Turn up', 'Underground', 'Volley', 'Wati B', 'Zinédine Zidane',
|
'Peluche', 'Pena baiona', "Peu d'alcool", 'Pilier de bar', 'PMU', 'Poulpe', 'Punch', 'Rap',
|
||||||
|
'Réveil', 'Rock', 'Rugby', 'Sandwich', 'Serge', 'Shot', 'Sociable', 'Spectacle', 'Techno',
|
||||||
|
'Techno house', 'Thérapie Taxi', 'Tradition kchanaises', 'Troisième mi-temps', 'Turn up',
|
||||||
|
'Vodka', 'Vodka pomme', 'Volley', 'Vomi stratégique'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ REST_FRAMEWORK = {
|
|||||||
'rest_framework.authentication.TokenAuthentication',
|
'rest_framework.authentication.TokenAuthentication',
|
||||||
'oauth2_provider.contrib.rest_framework.OAuth2Authentication',
|
'oauth2_provider.contrib.rest_framework.OAuth2Authentication',
|
||||||
],
|
],
|
||||||
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
'DEFAULT_PAGINATION_CLASS': 'apps.api.pagination.CustomPagination',
|
||||||
'PAGE_SIZE': 20,
|
'PAGE_SIZE': 20,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,9 @@ mark {
|
|||||||
|
|
||||||
/* Last BDE colors */
|
/* Last BDE colors */
|
||||||
.bg-primary {
|
.bg-primary {
|
||||||
background-color: rgb(102, 83, 105) !important;
|
/* background-color: rgb(18, 67, 4) !important; */
|
||||||
|
/* MODE VIEUXCON=ON */
|
||||||
|
background-color: rgb(0, 119, 139) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
@ -81,14 +83,14 @@ body {
|
|||||||
.btn-outline-primary:not(:disabled):not(.disabled).active,
|
.btn-outline-primary:not(:disabled):not(.disabled).active,
|
||||||
.btn-outline-primary:not(:disabled):not(.disabled):active {
|
.btn-outline-primary:not(:disabled):not(.disabled):active {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background-color: rgb(102, 83, 105);
|
background-color: rgb(0, 119, 139);
|
||||||
border-color: rgb(102, 83, 105);
|
border-color: rgb(0, 119, 139);
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-outline-primary {
|
.btn-outline-primary {
|
||||||
color: rgb(102, 83, 105);
|
color: rgb(0, 119, 139);
|
||||||
background-color: rgba(248, 249, 250, 0.9);
|
background-color: rgba(248, 249, 250, 0.9);
|
||||||
border-color: rgb(102, 83, 105);
|
border-color: rgb(0, 119, 139);
|
||||||
}
|
}
|
||||||
|
|
||||||
.turbolinks-progress-bar {
|
.turbolinks-progress-bar {
|
||||||
@ -99,35 +101,35 @@ body {
|
|||||||
.btn-primary:not(:disabled):not(.disabled).active,
|
.btn-primary:not(:disabled):not(.disabled).active,
|
||||||
.btn-primary:not(:disabled):not(.disabled):active {
|
.btn-primary:not(:disabled):not(.disabled):active {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background-color: rgb(102, 83, 105);
|
background-color: rgb(0, 119, 139);
|
||||||
border-color: rgb(102, 83, 105);
|
border-color: rgb(0, 119, 139);
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-primary {
|
.btn-primary {
|
||||||
color: rgba(248, 249, 250, 0.9);
|
color: rgba(248, 249, 250, 0.9);
|
||||||
background-color: rgb(102, 83, 105);
|
background-color: rgb(0, 119, 139);
|
||||||
border-color: rgb(102, 83, 105);
|
border-color: rgb(0, 119, 139);
|
||||||
}
|
}
|
||||||
|
|
||||||
.border-primary {
|
.border-primary {
|
||||||
border-color: rgb(115, 15, 115) !important;
|
border-color: rgb(0,85, 102) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: rgb(102, 83, 105);
|
color: rgb(0, 119, 139);
|
||||||
}
|
}
|
||||||
|
|
||||||
a:hover {
|
a:hover {
|
||||||
color: rgb(200, 30, 200);
|
color: rgb(0, 171, 205);
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-control:focus {
|
.form-control:focus {
|
||||||
box-shadow: 0 0 0 0.25rem rgba(200, 30, 200, 0.25);
|
box-shadow: 0 0 0 0.25rem rgba(0, 171, 205, 0.25);
|
||||||
border-color: rgb(200, 30, 200);
|
border-color: rgb(0, 171, 205);
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-outline-primary.focus {
|
.btn-outline-primary.focus {
|
||||||
box-shadow: 0 0 0 0.25rem rgba(200, 30, 200, 0.5);
|
box-shadow: 0 0 0 0.25rem rgba(0, 171, 205, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,11 +96,13 @@ function displayStyle (note) {
|
|||||||
if (!note) { return '' }
|
if (!note) { return '' }
|
||||||
const balance = note.balance
|
const balance = note.balance
|
||||||
var css = ''
|
var css = ''
|
||||||
|
var ms_per_year = 31536000000 // 365 * 24 * 3600 * 1000
|
||||||
if (balance < -5000) { css += ' text-danger bg-dark' }
|
if (balance < -5000) { css += ' text-danger bg-dark' }
|
||||||
else if (balance < -1000) { css += ' text-danger' }
|
else if (balance < -1000) { css += ' text-danger' }
|
||||||
else if (balance < 0) { css += ' text-warning' }
|
else if (balance < 0) { css += ' text-warning' }
|
||||||
if (!note.email_confirmed) { css += ' bg-primary' }
|
if (!note.email_confirmed) { css += ' bg-primary' }
|
||||||
else if (!note.is_active || (note.membership && note.membership.date_end < new Date().toISOString())) { css += ' bg-info' }
|
else if (!note.is_active || (note.membership && note.membership.date_end < new Date().toISOString())) { css += ' bg-info' }
|
||||||
|
if (((Date.now() - Date.parse(note.created_at))/ms_per_year) > 3) { css += 'font-weight-bold' }
|
||||||
return css
|
return css
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form|crispy }}
|
{{ form|crispy }}
|
||||||
{{ profile_form|crispy }}
|
{{ profile_form|crispy }}
|
||||||
{{ soge_form|crispy }}
|
{% comment "Soge not for membership (only WEI)" %} {{ soge_form|crispy }} {% endcomment %}
|
||||||
<button class="btn btn-success" type="submit">
|
<button class="btn btn-success" type="submit">
|
||||||
{% trans "Sign up" %}
|
{% trans "Sign up" %}
|
||||||
</button>
|
</button>
|
||||||
|
Reference in New Issue
Block a user