Commit d815b6ff authored by Och's avatar Och
Browse files

subscription: Corrected bad changes

parent 36fed2fe
Pipeline #2208 failed with stage
in 30 minutes and 34 seconds
......@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-26 13:35+0200\n"
"POT-Creation-Date: 2020-08-27 14:47+0200\n"
"PO-Revision-Date: 2016-07-18\n"
"Last-Translator: Skia <skia@libskia.so>\n"
"Language-Team: AE info <ae.info@utbm.fr>\n"
......@@ -4755,12 +4755,12 @@ msgid "Washing and drying"
msgstr "Lavage et séchage"
#: launderette/templates/launderette/launderette_book.jinja:27
#: sith/settings.py:561
#: sith/settings.py:594
msgid "Washing"
msgstr "Lavage"
#: launderette/templates/launderette/launderette_book.jinja:31
#: sith/settings.py:561
#: sith/settings.py:594
msgid "Drying"
msgstr "Séchage"
......@@ -5483,119 +5483,147 @@ msgid "One month for free"
msgstr "Un mois gratuit"
#: sith/settings.py:501
msgid "Two months for free"
msgstr "Deux mois gratuits"
#: sith/settings.py:503
msgid "Six weeks for free"
msgstr "Six semaines gratuites"
#: sith/settings.py:507
msgid "Eurock's volunteer"
msgstr "Bénévole Eurockéennes"
#: sith/settings.py:502
#: sith/settings.py:508
msgid "One day"
msgstr "Un jour"
#: sith/settings.py:503
#: sith/settings.py:509
msgid "GA staff member"
msgstr "Membre staff GA (2 semaines), 1 €"
#: sith/settings.py:521
#: sith/settings.py:512
msgid "One semester (-20%)"
msgstr "Un semestre, 20 €"
#: sith/settings.py:517
msgid "Two semesters (-20%)"
msgstr "Deux semestres, 35 €"
#: sith/settings.py:522
msgid "Common core cursus (-20%)"
msgstr "Cursus tronc commun, 60 €"
#: sith/settings.py:527
msgid "Branch cursus (-20%)"
msgstr "Cursus branche, 60 €"
#: sith/settings.py:532
msgid "Alternating cursus (-20%)"
msgstr "Cursus alternant, 30 €"
#: sith/settings.py:554
msgid "President"
msgstr "Président"
#: sith/settings.py:522
#: sith/settings.py:555
msgid "Vice-President"
msgstr "Vice-Président"
#: sith/settings.py:523
#: sith/settings.py:556
msgid "Treasurer"
msgstr "Trésorier"
#: sith/settings.py:524
#: sith/settings.py:557
msgid "Communication supervisor"
msgstr "Responsable communication"
#: sith/settings.py:525
#: sith/settings.py:558
msgid "Secretary"
msgstr "Secrétaire"
#: sith/settings.py:526
#: sith/settings.py:559
msgid "IT supervisor"
msgstr "Responsable info"
#: sith/settings.py:527
#: sith/settings.py:560
msgid "Board member"
msgstr "Membre du bureau"
#: sith/settings.py:528
#: sith/settings.py:561
msgid "Active member"
msgstr "Membre actif"
#: sith/settings.py:529
#: sith/settings.py:562
msgid "Curious"
msgstr "Curieux"
#: sith/settings.py:565
#: sith/settings.py:598
msgid "A new poster needs to be moderated"
msgstr "Une nouvelle affiche a besoin d'être modérée"
#: sith/settings.py:566
#: sith/settings.py:599
msgid "A new mailing list needs to be moderated"
msgstr "Une nouvelle mailing list a besoin d'être modérée"
#: sith/settings.py:569
#: sith/settings.py:602
msgid "A new pedagogy comment has been signaled for moderation"
msgstr ""
"Un nouveau commentaire de la pédagogie a été signalé pour la modération"
#: sith/settings.py:571
#: sith/settings.py:604
#, python-format
msgid "There are %s fresh news to be moderated"
msgstr "Il y a %s nouvelles toutes fraîches à modérer"
#: sith/settings.py:572
#: sith/settings.py:605
msgid "New files to be moderated"
msgstr "Nouveaux fichiers à modérer"
#: sith/settings.py:573
#: sith/settings.py:606
#, python-format
msgid "There are %s pictures to be moderated in the SAS"
msgstr "Il y a %s photos à modérer dans le SAS"
#: sith/settings.py:574
#: sith/settings.py:607
msgid "You've been identified on some pictures"
msgstr "Vous avez été identifié sur des photos"
#: sith/settings.py:575
#: sith/settings.py:608
#, python-format
msgid "You just refilled of %s €"
msgstr "Vous avez rechargé votre compte de %s€"
#: sith/settings.py:576
#: sith/settings.py:609
#, python-format
msgid "You just bought %s"
msgstr "Vous avez acheté %s"
#: sith/settings.py:577
#: sith/settings.py:610
msgid "You have a notification"
msgstr "Vous avez une notification"
#: sith/settings.py:589
#: sith/settings.py:622
msgid "Success!"
msgstr "Succès !"
#: sith/settings.py:590
#: sith/settings.py:623
msgid "Fail!"
msgstr "Échec !"
#: sith/settings.py:591
#: sith/settings.py:624
msgid "You successfully posted an article in the Weekmail"
msgstr "Article posté avec succès dans le Weekmail"
#: sith/settings.py:592
#: sith/settings.py:625
msgid "You successfully edited an article in the Weekmail"
msgstr "Article édité avec succès dans le Weekmail"
#: sith/settings.py:593
#: sith/settings.py:626
msgid "You successfully sent the Weekmail"
msgstr "Weekmail envoyé avec succès"
#: sith/settings.py:601
#: sith/settings.py:634
msgid "AE tee-shirt"
msgstr "Tee-shirt AE"
......
......@@ -498,9 +498,42 @@ SITH_SUBSCRIPTIONS = {
"duration": 1,
},
"un-mois-essai": {"name": _("One month for free"), "price": 0, "duration": 0.16666},
"deux-mois-essai": {"name": _("Two months for free"), "price": 0, "duration": 0.33},
"six-semaines-essai": {
"name": _("Six weeks for free"),
"price": 0,
"duration": 0.23,
},
"benevoles-euroks": {"name": _("Eurok's volunteer"), "price": 5, "duration": 0.1},
"un-jour": {"name": _("One day"), "price": 0, "duration": 0.00555333},
"membre-staff-ga": {"name": _("GA staff member"), "price": 1, "duration": 0.076},
# Discount subscriptions
"un-semestre-reduction": {
"name": _("One semester (-20%)"),
"price": 12,
"duration": 1,
},
"deux-semestres-reduction": {
"name": _("Two semesters (-20%)"),
"price": 22,
"duration": 2,
},
"cursus-tronc-commun-reduction": {
"name": _("Common core cursus (-20%)"),
"price": 36,
"duration": 4,
},
"cursus-branche-reduction": {
"name": _("Branch cursus (-20%)"),
"price": 36,
"duration": 6,
},
"cursus-alternant-reduction": {
"name": _("Alternating cursus (-20%)"),
"price": 24,
"duration": 6,
}
# To be completed....
}
SITH_CLUB_ROLES = {}
......
# Generated by Django 2.2.13 on 2020-08-27 12:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("subscription", "0013_auto_20200826_1332"),
]
operations = [
migrations.AlterField(
model_name="subscription",
name="subscription_type",
field=models.CharField(
choices=[
("amicale/doceo", "Amicale/DOCEO member"),
("assidu", "Assidu member"),
("benevoles-euroks", "Eurok's volunteer"),
("crous", "CROUS member"),
("cursus-alternant", "Alternating cursus"),
("cursus-alternant-reduction", "Alternating cursus (-20%)"),
("cursus-branche", "Branch cursus"),
("cursus-branche-reduction", "Branch cursus (-20%)"),
("cursus-tronc-commun", "Common core cursus"),
("cursus-tronc-commun-reduction", "Common core cursus (-20%)"),
("deux-mois-essai", "Two months for free"),
("deux-semestres", "Two semesters"),
("deux-semestres-reduction", "Two semesters (-20%)"),
("membre-honoraire", "Honorary member"),
("membre-staff-ga", "GA staff member"),
("reseau-ut", "UT network member"),
("sbarro/esta", "Sbarro/ESTA member"),
("six-semaines-essai", "Six weeks for free"),
("un-jour", "One day"),
("un-mois-essai", "One month for free"),
("un-semestre", "One semester"),
("un-semestre-reduction", "One semester (-20%)"),
("un-semestre-welcome", "One semester Welcome Week"),
],
max_length=255,
verbose_name="subscription type",
),
),
]
......@@ -137,7 +137,8 @@ class Subscription(models.Model):
"sbarro/esta": 9,
"cursus-alternant": 10,
"welcome-semestre": 11,
"un-mois-essai": 12,
"deux-mois-essai": 12,
"un-mois-essai": 13,
}
PAYMENT = {
"CHECK": 1,
......
......@@ -114,6 +114,18 @@ class SubscriptionIntegrationTest(TestCase):
call_command("populate")
self.user = User.objects.filter(username="public").first()
def test_duration_six_weeks(self):
s = Subscription(
member=User.objects.filter(pk=self.user.pk).first(),
subscription_type=list(settings.SITH_SUBSCRIPTIONS.keys())[3],
payment_method=settings.SITH_SUBSCRIPTION_PAYMENT_METHOD[0],
)
s.subscription_start = date(2018, 9, 1)
s.subscription_end = s.compute_end(duration=0.23, start=s.subscription_start)
s.save()
self.assertTrue(s.subscription_end == date(2018, 10, 13))
def test_duration_one_month(self):
s = Subscription(
......@@ -122,10 +134,22 @@ class SubscriptionIntegrationTest(TestCase):
payment_method=settings.SITH_SUBSCRIPTION_PAYMENT_METHOD[0],
)
s.subscription_start = date(2017, 8, 29)
s.subscription_end = s.compute_end(duration=0.16666, start=s.subscription_start)
s.subscription_end = s.compute_end(duration=0.166, start=s.subscription_start)
s.save()
self.assertTrue(s.subscription_end == date(2017, 9, 29))
def test_duration_two_months(self):
s = Subscription(
member=User.objects.filter(pk=self.user.pk).first(),
subscription_type="deux-mois-essai",
payment_method=settings.SITH_SUBSCRIPTION_PAYMENT_METHOD[0],
)
s.subscription_start = date(2017, 8, 29)
s.subscription_end = s.compute_end(duration=0.33, start=s.subscription_start)
s.save()
self.assertTrue(s.subscription_end == date(2017, 10, 29))
def test_duration_one_day(self):
s = Subscription(
......@@ -189,11 +213,11 @@ class SubscriptionIntegrationTest(TestCase):
self.assertTrue(d == date(2017, 8, 29))
@mock.patch("subscription.models.date", FakeDate)
def test_dates_renewal_sliding_during_one_free_month(self):
def test_dates_renewal_sliding_during_two_free_months(self):
user = User.objects.filter(pk=self.user.pk).first()
s = Subscription(
member=user,
subscription_type="un-mois-essai",
subscription_type="deux-mois-essai",
payment_method=settings.SITH_SUBSCRIPTION_PAYMENT_METHOD[0],
)
s.subscription_start = date(2015, 8, 29)
......@@ -202,20 +226,20 @@ class SubscriptionIntegrationTest(TestCase):
start=s.subscription_start,
)
s.save()
self.assertTrue(s.subscription_end == date(2015, 9, 29))
self.assertTrue(s.subscription_end == date(2015, 10, 29))
date_mock_today(2015, 9, 25)
d = Subscription.compute_end(
duration=settings.SITH_SUBSCRIPTIONS["deux-semestres"]["duration"],
user=user,
)
self.assertTrue(d == date(2016, 9, 29))
self.assertTrue(d == date(2016, 10, 29))
@mock.patch("subscription.models.date", FakeDate)
def test_dates_renewal_sliding_after_one_free_month(self):
def test_dates_renewal_sliding_after_two_free_month(self):
user = User.objects.filter(pk=self.user.pk).first()
s = Subscription(
member=user,
subscription_type="un-mois-essai",
subscription_type="deux-mois-essai",
payment_method=settings.SITH_SUBSCRIPTION_PAYMENT_METHOD[0],
)
s.subscription_start = date(2015, 8, 29)
......@@ -224,7 +248,7 @@ class SubscriptionIntegrationTest(TestCase):
start=s.subscription_start,
)
s.save()
self.assertTrue(s.subscription_end == date(2015, 9, 29))
self.assertTrue(s.subscription_end == date(2015, 10, 29))
date_mock_today(2015, 11, 5)
d = Subscription.compute_end(
duration=settings.SITH_SUBSCRIPTIONS["deux-semestres"]["duration"],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment