Skip to content

Commit

Permalink
fix: FR bugs (#1244)
Browse files Browse the repository at this point in the history
## Describe your changes

Fixes: #
  • Loading branch information
didrikmunther authored Aug 4, 2024
1 parent 10ca538 commit b1823c1
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 45 deletions.
1 change: 0 additions & 1 deletion dashboard/api/registration/types/cr.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class CRRegistrationSerializer(RegistrationSerializer):

def update(self, instance, validated_data):
update_field(instance, validated_data, "company", CRCompanySerializer)
update_field(instance, validated_data, "exhibitor", ExhibitorSerializer)

orders = validated_data.pop("orders", None)
if orders != None:
Expand Down
22 changes: 0 additions & 22 deletions dashboard/api/registration/types/ir.py

This file was deleted.

3 changes: 3 additions & 0 deletions dashboard/api/registration/types/serializer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from rest_framework import serializers
from drf_writable_nested import WritableNestedModelSerializer
from companies.serializers import CompanySerializer
from people.models import Profile
from recruitment.models import RecruitmentApplication

Expand Down Expand Up @@ -238,6 +239,7 @@ class RegistrationSerializer(serializers.Serializer):
orders = OrderSerializer(many=True)
contact = CompanyContactSerializer()
exhibitor = ExhibitorSerializer()
company = CompanySerializer()
interested_in = InterestedInSerializer(many=True)

# Add the 'fair' context to sales_contacts
Expand All @@ -257,6 +259,7 @@ def to_representation(self, instance):

def update(self, instance, validated_data):
update_field(instance, validated_data, "contact", CompanyContactSerializer)
update_field(instance, validated_data, "exhibitor", ExhibitorSerializer)

interested_in = validated_data.pop("interested_in", None)
if interested_in != None:
Expand Down
33 changes: 16 additions & 17 deletions dashboard/api/registration/types/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
CRRegistrationSerializer,
CRSignedRegistrationSerializer,
)
from dashboard.api.registration.types.ir import IRRegistrationSerializer

from dashboard.api.registration.types.serializer import RegistrationSerializer
from fair.models import RegistrationPeriod

from util import status, get_user
Expand All @@ -21,23 +21,22 @@ def get_serializer(request, registration, data=empty, context={}):
if user != None:
permission = UserPermission(user)

if registration.period in [
RegistrationPeriod.BEFORE_IR,
RegistrationPeriod.IR,
RegistrationPeriod.BETWEEN_IR_AND_CR,
]:
Serializer = IRRegistrationSerializer
if (
registration.period
in [
RegistrationPeriod.BEFORE_IR,
RegistrationPeriod.IR,
RegistrationPeriod.BETWEEN_IR_AND_CR,
]
or registration.ir_signature is None
):
Serializer = RegistrationSerializer
elif registration.period in [RegistrationPeriod.CR]:
Serializer = CRRegistrationSerializer

if registration.ir_signature == None: # If IR has not been signed
Serializer = IRRegistrationSerializer
elif registration.cr_signature:
# If user is sales, they may change anything he likes
if permission == UserPermission.SALES:
Serializer = CRRegistrationSerializer
else:
Serializer = CRSignedRegistrationSerializer
# If user is sales, they may change anything he likes
if permission == UserPermission.SALES or registration.cr_signature is None:
Serializer = CRRegistrationSerializer
else:
Serializer = CRSignedRegistrationSerializer

elif registration.period in [
RegistrationPeriod.AFTER_CR,
Expand Down
5 changes: 4 additions & 1 deletion exhibitors/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ def exhibitors(request):
)

exhibitors = (
Exhibitor.objects.filter(fair__in=Fair.objects.filter(**fair_criteria))
Exhibitor.objects.filter(
fair__in=Fair.objects.filter(**fair_criteria),
application_status="accepted",
)
.select_related(
"company",
"fair",
Expand Down
4 changes: 0 additions & 4 deletions templates/register/email/ir_complete.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
What happens now:
</p>
<ul>
<li style="font-size:16px;line-height:24px;margin:16px 0;color:#525f7f;text-align:left">
We are reviewing registrations and will confirm your registration by {{ ir_application_review_date|date:"Y-m-d" }}.
This is to make sure we do not take in more exhibitors than we have space for.
</li>
<li style="font-size:16px;line-height:24px;margin:16px 0;color:#525f7f;text-align:left">
Final registration opens {{ fair.complete_registration_start_date|date:"Y-m-d" }} on the same dashboard.
There you make your final choice of package, events and other products.
Expand Down

0 comments on commit b1823c1

Please sign in to comment.