From 293f501bf0e815dcf7a3281c603caf95c5a6762c Mon Sep 17 00:00:00 2001 From: nanoy42 <46190446+nanoy42@users.noreply.github.com> Date: Sun, 23 Jun 2019 20:00:21 +0200 Subject: [PATCH 1/4] Create LICENSE --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7b3f981 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Yoann `Nanoy` Pietri + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 4a577e08cbcbeea1c04ad4402f6ec6ddf485e71c Mon Sep 17 00:00:00 2001 From: nanoy Date: Sun, 23 Jun 2019 20:01:33 +0200 Subject: [PATCH 2/4] Add django-tex license --- django_tex/LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 django_tex/LICENSE diff --git a/django_tex/LICENSE b/django_tex/LICENSE new file mode 100644 index 0000000..f3d9af1 --- /dev/null +++ b/django_tex/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Martin Bierbaum + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 325ceada7dbe2912e620fad6e23d00a7fa8ac82e Mon Sep 17 00:00:00 2001 From: nanoy Date: Thu, 27 Jun 2019 23:03:19 +0200 Subject: [PATCH 3/4] Fix divide issues --- gestion/views.py | 8 +++--- .../migrations/0018_auto_20190627_2302.py | 27 +++++++++++++++++++ preferences/models.py | 6 ++++- users/migrations/0011_auto_20190627_2302.py | 23 ++++++++++++++++ users/models.py | 2 +- 5 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 preferences/migrations/0018_auto_20190627_2302.py create mode 100644 users/migrations/0011_auto_20190627_2302.py diff --git a/gestion/views.py b/gestion/views.py index 3249606..8077f31 100644 --- a/gestion/views.py +++ b/gestion/views.py @@ -994,14 +994,14 @@ def divide(request): cotisation_history.save() divide_history = DivideHistory( total_cotisations = non_divided_cotisations.count(), - total_cotisations_amount = sum([x.amount for x in non_divided_cotisations]), - total_ptm_amount = sum([x.amount_ptm for x in non_divided_cotisations]), + total_cotisations_amount = sum([x.amount or 0 for x in non_divided_cotisations]), + total_ptm_amount = sum([x.amount_ptm or 0 for x in non_divided_cotisations]), coopeman = request.user ) divide_history.save() non_divided_cotisations = CotisationHistory.objects.filter(divided=False) - total_amount = sum([x.amount for x in non_divided_cotisations]) - total_amount_ptm = sum([x.amount_ptm for x in non_divided_cotisations]) + total_amount = sum([x.amount or 0 for x in non_divided_cotisations]) + total_amount_ptm = sum([x.amount_ptm or 0 for x in non_divided_cotisations]) divide_histories = DivideHistory.objects.all().order_by('-date') return render( request, diff --git a/preferences/migrations/0018_auto_20190627_2302.py b/preferences/migrations/0018_auto_20190627_2302.py new file mode 100644 index 0000000..4fb3748 --- /dev/null +++ b/preferences/migrations/0018_auto_20190627_2302.py @@ -0,0 +1,27 @@ +# Generated by Django 2.1 on 2019-06-27 21:02 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('preferences', '0017_auto_20190623_1453'), + ] + + operations = [ + migrations.AlterModelOptions( + name='priceprofile', + options={'verbose_name': 'Profil de prix', 'verbose_name_plural': 'Profils de prix'}, + ), + migrations.AlterField( + model_name='cotisation', + name='amount_ptm', + field=models.DecimalField(decimal_places=2, default=0, max_digits=5, null=True, verbose_name='Montant pour le club Phœnix Technopôle Metz'), + ), + migrations.AlterField( + model_name='historicalcotisation', + name='amount_ptm', + field=models.DecimalField(decimal_places=2, default=0, max_digits=5, null=True, verbose_name='Montant pour le club Phœnix Technopôle Metz'), + ), + ] diff --git a/preferences/models.py b/preferences/models.py index 6ae3af1..161b079 100644 --- a/preferences/models.py +++ b/preferences/models.py @@ -129,7 +129,7 @@ class Cotisation(models.Model): """ Duration (in days) of the cotisation """ - amount_ptm = models.DecimalField(max_digits=5, decimal_places=2, null=True, verbose_name="Montant pour le club Phœnix Technopôle Metz") + amount_ptm = models.DecimalField(max_digits=5, decimal_places=2, null=True, verbose_name="Montant pour le club Phœnix Technopôle Metz", default=0) """ Amount of money given to the PTM club """ @@ -178,6 +178,10 @@ class PriceProfile(models.Model): """ Stores parameters to compute price """ + class Meta: + verbose_name = "Profil de prix" + verbose_name_plural = "Profils de prix" + name = models.CharField(max_length=255, verbose_name="Nom") a = models.DecimalField(verbose_name="Marge constante", max_digits=3, decimal_places=2) b = models.DecimalField(verbose_name="Marge variable", max_digits=3, decimal_places=2) diff --git a/users/migrations/0011_auto_20190627_2302.py b/users/migrations/0011_auto_20190627_2302.py new file mode 100644 index 0000000..fb70f9a --- /dev/null +++ b/users/migrations/0011_auto_20190627_2302.py @@ -0,0 +1,23 @@ +# Generated by Django 2.1 on 2019-06-27 21:02 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0010_auto_20190623_1656'), + ] + + operations = [ + migrations.AlterField( + model_name='cotisationhistory', + name='amount_ptm', + field=models.DecimalField(decimal_places=2, default=0, max_digits=5, null=True, verbose_name='Montant pour le club Phœnix Technopôle Metz'), + ), + migrations.AlterField( + model_name='historicalcotisationhistory', + name='amount_ptm', + field=models.DecimalField(decimal_places=2, default=0, max_digits=5, null=True, verbose_name='Montant pour le club Phœnix Technopôle Metz'), + ), + ] diff --git a/users/models.py b/users/models.py index c719268..080b812 100644 --- a/users/models.py +++ b/users/models.py @@ -65,7 +65,7 @@ class CotisationHistory(models.Model): """ True if money of cotisation have been divided between CTM and PTM """ - amount_ptm = models.DecimalField(max_digits=5, decimal_places=2, null=True, verbose_name="Montant pour le club Phœnix Technopôle Metz") + amount_ptm = models.DecimalField(max_digits=5, decimal_places=2, null=True, verbose_name="Montant pour le club Phœnix Technopôle Metz", default=0) """ Amount of money given to the PTM club """ From 5cce28f3e10c7909483fde295db65f76289b1c8d Mon Sep 17 00:00:00 2001 From: nanoy Date: Thu, 27 Jun 2019 23:04:16 +0200 Subject: [PATCH 4/4] Update version info --- CHANGELOG.md | 2 ++ templates/footer.html | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91f5e32..d203c33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## v3.6.1 +* Valeur par défaut des répartitions et calcul des répartitions ## v3.6.0 * AJout d'un débit direct comme champ du profil * Suppression des codes bare diff --git a/templates/footer.html b/templates/footer.html index 56b05ba..45bc12e 100644 --- a/templates/footer.html +++ b/templates/footer.html @@ -42,6 +42,6 @@
  • Facebook
  • - +