Skip to content

Commit

Permalink
fix(backend): only export registered users
Browse files Browse the repository at this point in the history
  • Loading branch information
Adibov committed Dec 5, 2023
1 parent 4aa2af8 commit 7ca9504
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions backend/backend_api/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from backend_api import models
from backend_api.email import MailerThread
from backend_api.models import Discount, Presentation
from backend_api.models import Discount, Presentation, PresentationParticipation, WorkshopRegistration
from utils.skyroom_exporter import SkyroomCredentials, convert_credentials_to_csv_response


Expand Down Expand Up @@ -123,7 +123,8 @@ class Meta:
def export_login_credentials(self, request, obj):
user_credentials: list[SkyroomCredentials] = []
for presentation in obj:
for presentation_registration in presentation.presentationparticipation_set.all():
for presentation_registration in presentation.presentationparticipation_set.filter(
status=PresentationParticipation.StatusChoices.PURCHASED):
user_credentials.append(
SkyroomCredentials(presentation_registration.username, presentation_registration.password,
presentation_registration.user.account.email))
Expand All @@ -143,7 +144,8 @@ class Meta:
def export_login_credentials(self, request, obj):
user_credentials: list[SkyroomCredentials] = []
for workshop in obj:
for workshop_registration in workshop.workshopregistration_set.all():
for workshop_registration in workshop.workshopregistration_set.filter(
status=WorkshopRegistration.StatusChoices.PURCHASED):
user_credentials.append(
SkyroomCredentials(workshop_registration.username, workshop_registration.password,
workshop_registration.user.account.email))
Expand Down

0 comments on commit 7ca9504

Please sign in to comment.