Skip to content

Commit

Permalink
Merge pull request #681 from FJNR-inc/develop
Browse files Browse the repository at this point in the history
New release
  • Loading branch information
RignonNoel authored Sep 14, 2020
2 parents 82a263e + 70ac2a9 commit 163120f
Show file tree
Hide file tree
Showing 9 changed files with 323 additions and 62 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ before_install:
- python3 -c 'import os,sys; os.set_blocking(sys.stdout.fileno(), True)'
install:
- docker-compose build
- pip install --upgrade pip
- pip install -r requirements-dev.txt
before_script:
# We will run a postgres service into docker, so wee need to stop the postgres service
Expand Down
13 changes: 7 additions & 6 deletions blitz_api/factories.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from datetime import timedelta

import factory
from factory.django import DjangoModelFactory
import factory.fuzzy
from dateutil.tz import tz
from django.contrib.auth import get_user_model
Expand All @@ -15,7 +16,7 @@
fake = Faker()


class UserFactory(factory.DjangoModelFactory):
class UserFactory(DjangoModelFactory):
class Meta:
model = User
django_get_or_create = ('username',)
Expand All @@ -29,7 +30,7 @@ class Meta:
tickets = 1


class AdminFactory(factory.DjangoModelFactory):
class AdminFactory(DjangoModelFactory):
class Meta:
model = User

Expand All @@ -42,28 +43,28 @@ class Meta:
tickets = 1


class OrganizationFactory(factory.DjangoModelFactory):
class OrganizationFactory(DjangoModelFactory):
class Meta:
model = Organization

name = factory.Sequence(lambda n: f'Organization {n}')


class AcademicLevelFactory(factory.DjangoModelFactory):
class AcademicLevelFactory(DjangoModelFactory):
class Meta:
model = AcademicLevel

name = factory.Sequence(lambda n: f'AcademicLevel {n}')


class AcademicFieldFactory(factory.DjangoModelFactory):
class AcademicFieldFactory(DjangoModelFactory):
class Meta:
model = AcademicField

name = factory.Sequence(lambda n: f'AcademicField {n}')


class RetreatFactory(factory.DjangoModelFactory):
class RetreatFactory(DjangoModelFactory):
class Meta:
model = Retreat
django_get_or_create = ('name',)
Expand Down
3 changes: 1 addition & 2 deletions blitz_api/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
'storages',
'anymail',
'simple_history',
'rest_framework_filters',
'safedelete',
'import_export',
'django_filters',
Expand Down Expand Up @@ -387,7 +386,7 @@
),
'POLICY_URL': config(
'POLICY_URL',
default='http://thesez-vous.org/policy',
default='https://www.thesez-vous.com/politiquesannulation.html',
),
'ACTIVATION_URL': config(
'ACTIVATION_URL',
Expand Down
10 changes: 5 additions & 5 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pycodestyle==2.5.0
coveralls==2.0.0
responses==0.10.14
awscli==1.18.43
six==1.14.0
pycodestyle==2.6.0
coveralls==2.1.2
responses==0.12.0
awscli==1.18.130
six==1.15.0
31 changes: 15 additions & 16 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
# Documentation tools
mkdocs==1.1.2
mkdocs-material==5.2.3
mkdocs-material==5.5.12

Django==2.2.12
djangorestframework==3.11.0
django-cors-headers==3.2.1
django-filter==2.2.0
Django==2.2.13
djangorestframework==3.11.1
django-cors-headers==3.5.0
django-filter==2.3.0
coreapi==2.3.3
factory-boy==2.12.0
factory-boy==3.0.1
Pygments==2.6.1
Markdown==3.2.1
django-anymail==7.1.0
Pillow==7.1.1
django-simple-history==2.8.0
djangorestframework-filters==0.11.1
Markdown==3.2.2
django-anymail==7.2.1
Pillow==7.2.0
django-simple-history==2.11.0
python-decouple==3.3
django-storages==1.9.1
django-storages==1.10
dj_database_url==0.5.0
zappa==0.51.0
psycopg2-binary==2.8.5
django-safedelete==0.5.2
-e git+https://github.com/Rhumbix/django-request-logging.git@9342ee6064e678fd162418b142d781550d23101c#egg=django_request_logging
-e git+https://github.com/deschler/django-modeltranslation.git@c8bda494a8cd36b393811552aeee71faf86d7438#egg=django-modeltranslation
django-import-export==2.0.2
django-import-export==2.3.0
jsonfield==3.1.0
django-model-utils==4.0.0
tqdm==4.45.0
tqdm==4.48.2
colorama==0.4.3
django-admin-autocomplete-filter==0.5
mailchimp3==3.0.13
django-admin-autocomplete-filter==0.6.1
mailchimp3==3.0.14
babel==2.8.0
50 changes: 32 additions & 18 deletions retirement/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,15 +385,22 @@ def validate(self, attrs):
active_reservations = active_reservations.all()

for reservation in active_reservations:
latest_start = max(reservation.retreat.start_time, start)
shortest_end = min(reservation.retreat.end_time, end)
if latest_start < shortest_end:
raise serializers.ValidationError({
'non_field_errors': [_(
"This reservation overlaps with another active "
"reservations for this user."
)]
})
for date in reservation.retreat.retreat_dates.all():
latest_start = max(
date.start_time,
start,
)
shortest_end = min(
date.end_time,
end,
)
if latest_start < shortest_end:
raise serializers.ValidationError({
'non_field_errors': [_(
"This reservation overlaps with another active "
"reservations for this user."
)]
})
return attrs

def create(self, validated_data):
Expand Down Expand Up @@ -585,15 +592,22 @@ def update(self, instance, validated_data):
).exclude(pk=instance.pk)

for reservation in active_reservations:
latest_start = max(reservation.retreat.start_time, start)
shortest_end = min(reservation.retreat.end_time, end)
if latest_start < shortest_end:
raise serializers.ValidationError({
'non_field_errors': [_(
"This reservation overlaps with another "
"active reservations for this user."
)]
})
for date in reservation.retreat.retreat_dates.all():
latest_start = max(
date.start_time,
start,
)
shortest_end = min(
date.end_time,
end,
)
if latest_start < shortest_end:
raise serializers.ValidationError({
'non_field_errors': [_(
"This reservation overlaps with another "
"active reservations for this user."
)]
})
if need_transaction:
order = Order.objects.create(
user=user,
Expand Down
Loading

0 comments on commit 163120f

Please sign in to comment.