From 071d1595b4af5a711875706a8fd47ee2887656fe Mon Sep 17 00:00:00 2001 From: Hieu Lam - TMA <135117837+lthanhhieu@users.noreply.github.com> Date: Mon, 25 Mar 2024 19:38:00 +0700 Subject: [PATCH] fix-9127: Add the unique ticket code into the downlad CSV file (#9134) * fix-9127: Add the unique ticket code into the downlad CSV file * fix-9127: Add the unique ticket code into the downlad CSV file * fix-9127: Add the unique ticket code into the downlad CSV file * fix-9127: Add the unique ticket code into the downlad CSV file --- app/api/helpers/csv_jobs_util.py | 2 +- app/models/ticket_holder.py | 7 +------ app/templates/pdf/attendees_pdf.html | 4 ++-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/app/api/helpers/csv_jobs_util.py b/app/api/helpers/csv_jobs_util.py index edf9b3f88e..71ae66d7ae 100644 --- a/app/api/helpers/csv_jobs_util.py +++ b/app/api/helpers/csv_jobs_util.py @@ -107,7 +107,7 @@ def get_order_ticket_data(attendee, order, ticket): ticketId = '' if order.identifier: if not attendee.identifier: - ticketId = order.identifier + '-' + attendee.get_new_identifier() + ticketId = order.identifier + '-' + str(attendee.id) else: ticketId = order.identifier + '-' + attendee.identifier diff --git a/app/models/ticket_holder.py b/app/models/ticket_holder.py index d9fa9251cb..ddea51fa41 100644 --- a/app/models/ticket_holder.py +++ b/app/models/ticket_holder.py @@ -118,7 +118,7 @@ def qr_code(self): ) identifier = self.identifier if not self.identifier: - identifier = get_new_id() + identifier = str(self.id) qr.add_data(self.order.identifier + "-" + identifier) qr.make(fit=True) @@ -155,8 +155,3 @@ def pdf_url_path(self) -> str: + self.order.identifier + '.pdf' ) - - @staticmethod - def get_new_identifier(): - """Generate a new identifier for the ticket holder.""" - return str(binascii.b2a_hex(os.urandom(3)), 'utf-8') diff --git a/app/templates/pdf/attendees_pdf.html b/app/templates/pdf/attendees_pdf.html index cc3047eef9..d4fefd4729 100644 --- a/app/templates/pdf/attendees_pdf.html +++ b/app/templates/pdf/attendees_pdf.html @@ -129,9 +129,9 @@