Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Show catalogue after CR #1287

Merged
merged 2 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion apps/dashboard/src/screens/dashboard/screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,10 @@ export function DashboardScreen({
title: "You have completed initial registration"
},
{
when: ["complete_registration:::*:::*"],
when: [
"*:::signed_cr:::*",
"complete_registration:::*:::*"
],
title: "Final registration",
badgeText: `${DateTime.fromISO(
dates.fr.start
Expand Down
5 changes: 4 additions & 1 deletion dashboard/api/registration/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ def submit_cr(request, company, fair, contact, exhibitor):
)

handle_submitted_order(fair, company)
send_cr_confirmation_email(request, fair, company, exhibitor, signature)
try:
send_cr_confirmation_email(request, fair, company, exhibitor, signature)
except Exception as e:
print("Failed to send email", e)

try:
registration = get_registration(company, fair, contact, exhibitor)
Expand Down
12 changes: 9 additions & 3 deletions fair/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ class Fair(models.Model):
def get_period(self):
time = timezone.now()

fair_days = FairDay.objects.filter(fair=self).values_list("date", flat=True)
if not fair_days:
raise ValueError("No fair days found for fair %s" % self)

if time < self.registration_start_date:
return RegistrationPeriod.BEFORE_IR
elif time >= self.registration_start_date and time < self.registration_end_date:
Expand All @@ -116,13 +120,15 @@ def get_period(self):
return RegistrationPeriod.CR
elif (
time >= self.complete_registration_close_date
and time < self.events_start_date
and min(fair_days) > time.date()
):
return RegistrationPeriod.AFTER_CR
elif time >= self.events_start_date and time < self.events_end_date:
elif min(fair_days) <= time.date() <= max(fair_days):
return RegistrationPeriod.FAIR
elif time >= self.events_end_date:
elif time.date() > max(fair_days):
return RegistrationPeriod.AFTER_FAIR
else:
raise ValueError("No period found for time %s" % time)

def is_member_of_fair(self, user):
if user.is_superuser:
Expand Down
Loading