From 55e2e21c6612a5410ffa059b9fbe38095203855b Mon Sep 17 00:00:00 2001 From: nnhathung Date: Thu, 3 Aug 2023 09:53:48 +0700 Subject: [PATCH 1/3] fix issue user request check in not admin --- app/api/user_check_in.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/app/api/user_check_in.py b/app/api/user_check_in.py index 1fc172d7c0..94a8df3f64 100644 --- a/app/api/user_check_in.py +++ b/app/api/user_check_in.py @@ -5,7 +5,6 @@ from sqlalchemy.orm.exc import NoResultFound from app.api.helpers.errors import UnprocessableEntityError -from app.api.helpers.permission_manager import has_access from app.api.helpers.permissions import jwt_required from app.api.helpers.static import STATION_TYPE from app.api.helpers.user_check_in import ( @@ -77,31 +76,16 @@ def before_post(_args, _kwargs, data): :return: """ require_relationship(['station'], data) - if not has_access('is_coorganizer', station=data.get('station')): - raise ObjectNotFound( - {'parameter': 'station'}, - f"Station: {data['station']} not found", - ) try: station = db.session.query(Station).filter_by(id=data.get('station')).one() except NoResultFound: raise ObjectNotFound({'parameter': data.get('station')}, "Station: not found") require_relationship(['ticket_holder'], data) - if not has_access('is_coorganizer', ticket_holder=data.get('ticket_holder')): - raise ObjectNotFound( - {'parameter': 'ticket_holder'}, - f"TicketHolder: {data['ticket_holder']} not found", - ) if station.station_type != STATION_TYPE.get('registration') or data.get( 'session' ): require_relationship(['session'], data) - if not has_access('is_coorganizer', session=data.get('session')): - raise ObjectNotFound( - {'parameter': 'session'}, - f"Session: {data['session']} not found", - ) def before_create_object(self, data, _view_kwargs): """ From 2d21b23862c0f7f351eba6601b11bdde3bc30f63 Mon Sep 17 00:00:00 2001 From: nnhathung Date: Mon, 7 Aug 2023 21:00:17 +0700 Subject: [PATCH 2/3] fix-9047: Unable to receive pdf from [/v1/badge-forms/print-badge-pdf] --- app/api/helpers/badge_forms.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/app/api/helpers/badge_forms.py b/app/api/helpers/badge_forms.py index e74fc84006..b0f56ec5d5 100644 --- a/app/api/helpers/badge_forms.py +++ b/app/api/helpers/badge_forms.py @@ -33,8 +33,8 @@ def create_preivew_badge_pdf(badgeForms): font_weight = [] font_style = [] text_decoration = [] - if badge_field.get('font_weight'): - for item in badge_field.get('font_weight'): + if badge_field['font_weight']: + for item in badge_field['font_weight']: if item.get('font_weight'): font_weight.append(item.get('font_weight')) if item.get('font_style'): @@ -148,8 +148,9 @@ def create_print_badge_pdf(badge_form, ticket_holder, list_field_show): font_weight = [] font_style = [] text_decoration = [] - if badge_field.get('font_weight'): - for item in badge_field.get('font_weight'): + badge_field.font_weight_tmp = badge_field.font_weight + if badge_field.font_weight: + for item in badge_field.font_weight: if item.get('font_weight'): font_weight.append(item.get('font_weight')) if item.get('font_style'): @@ -157,18 +158,17 @@ def create_print_badge_pdf(badge_form, ticket_holder, list_field_show): if item.get('text_decoration'): text_decoration.append(item.get('text_decoration')) if not font_weight: - badge_field['font_weight'] = 'none' + badge_field.font_weight = 'none' else: - badge_field['font_weight'] = ','.join(font_weight) + badge_field.font_weight = ','.join(font_weight) if not font_style: - badge_field['font_style'] = 'none' + badge_field.font_style = 'none' else: - badge_field['font_style'] = ','.join(font_style) + badge_field.font_style = ','.join(font_style) if not text_decoration: - badge_field['text_decoration'] = 'none' + badge_field.text_decoration = 'none' else: - badge_field['text_decoration'] = ','.join(text_decoration) - + badge_field.text_decoration = ','.join(text_decoration) create_save_pdf( render_template( 'pdf/badge_forms.html', badgeForms=badge_form, badgeFieldForms=badgeFieldForms @@ -178,5 +178,7 @@ def create_print_badge_pdf(badge_form, ticket_holder, list_field_show): ) ticket_holder.is_badge_printed = True ticket_holder.badge_printed_at = datetime.now() + for badge_field in badgeFieldForms: + badge_field.font_weight = badge_field.font_weight_tmp save_to_db(ticket_holder, 'Ticket Holder saved') return file_pdf_path(badge_form) From 038af44ccb6b87f34e14aa8bce3cb9ad75f2f31f Mon Sep 17 00:00:00 2001 From: nnhathung Date: Mon, 7 Aug 2023 21:02:46 +0700 Subject: [PATCH 3/3] fix-9047: Unable to receive pdf from [/v1/badge-forms/print-badge-pdf] --- app/api/user_check_in.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app/api/user_check_in.py b/app/api/user_check_in.py index efba85cce7..31277adb79 100644 --- a/app/api/user_check_in.py +++ b/app/api/user_check_in.py @@ -5,6 +5,7 @@ from sqlalchemy.orm.exc import NoResultFound from app.api.helpers.errors import UnprocessableEntityError +from app.api.helpers.permission_manager import has_access from app.api.helpers.permissions import jwt_required from app.api.helpers.static import STATION_TYPE from app.api.helpers.user_check_in import (