From 5aeca5c29e6031a11dd5f02b18f23696ece79906 Mon Sep 17 00:00:00 2001 From: Henry Lee Date: Wed, 19 Jun 2024 21:42:10 +0800 Subject: [PATCH 1/3] fix(app): update 2024 ticket name and price --- dags/app/team_registration_bot/udf.py | 33 ++++++++++++--------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/dags/app/team_registration_bot/udf.py b/dags/app/team_registration_bot/udf.py index d5761af..8558c95 100644 --- a/dags/app/team_registration_bot/udf.py +++ b/dags/app/team_registration_bot/udf.py @@ -6,6 +6,8 @@ from app import discord from google.cloud import bigquery +YEAR = datetime.now().year + TABLE = f"{os.getenv('BIGQUERY_PROJECT', 'pycontw-225217')}.ods.ods_kktix_attendeeId_datetime" CLIENT = bigquery.Client(project=os.getenv("BIGQUERY_PROJECT")) @@ -33,7 +35,7 @@ def _get_statistics_from_bigquery() -> Dict: FROM `{TABLE}` WHERE - ((REFUNDED IS NULL) OR (REFUNDED = FALSE)) AND (NAME LIKE "PyCon TW 2023 Registration%") + ((REFUNDED IS NULL) OR (REFUNDED = FALSE)) AND (NAME LIKE "PyCon TW {YEAR} Registration%") ) SELECT @@ -50,26 +52,19 @@ def _get_statistics_from_bigquery() -> Dict: ticket_price = { - "企業票 - 早鳥階段 (含紀念衣服) / Corporate - Early Stage (with T-Shirt)": 5500, + # please update the price for target year "企業票 - 一般階段 / Corporate - Regular Stage": 5800, "企業票 - 晚鳥階段 / Corporate - Final Stage": 6500, - "社群優惠票 (含紀念衣服) / Community Discount (with T-Shirt)": 2790, - "OSCVPass (含紀念衣服) / OSCVPass Discount (with T-Shirt)": 2790, - "超級 Py 粉票 (含紀念衣服) / PyCon TW Stans (with T-Shirt)": 1990, - "講者票 (含紀念衣服) / Speaker (with T-Shirt)": 1290, - "投稿者票 / Submitter": 1990, - "貢獻者票 (含紀念衣服) / Contributor (with T-Shirt)": 1290, - "大會贊助票 (歡迎申請) / Sponsorship from PyCon TW (Free to Apply)": 2490, - "邀請票 (含紀念衣服) / Invited (with T-Shirt)": 0, - "獎品預留票 (含紀念衣服) / Prize Reserved (with T-Shirt)": 1895, - "企業獎品預留票 (含紀念衣服) / Corporate Prize Reserved (with T-Shirt)": 2900, - "個人尊榮票 (含紀念衣服) / Premium (with T-Shirt)": 5500, - "團體票 (歡迎申請) / Group-Buy Individual (Free to Apply)": 0, - "個人票 - 早鳥階段 (含紀念衣服) / Individual - Early Stage (with T-Shirt)": 2990, - "個人票 - 一般階段 / Individual - Regular Stage": 3790, + "企業團體票 (歡迎申請) / Group-Buy Corporate (Free to Apply)": 5220, + "優惠票 (含紀念衣服) / Reserved - Community (with T-Shirt)": 2590, + "貢獻者票 (含紀念衣服) / Reserved - Contributor (with T-Shirt)": 1290, + "財務補助票 / Reserved - Financial Aid": 0, + "邀請票 (含紀念衣服) / Reserved - Invited (with T-Shirt)": 0, + "個人贊助票 (含紀念衣服) / Individual - Sponsor (with T-Shirt)": 5500, + "個人票 - 早鳥 (含紀念衣服) / Individual - Early Stage (with T-Shirt)": 2790, + "個人票 - 一般 (含紀念衣服)/ Individual - Regular Stage (with T-Shirt)": 3790, "個人票 - 晚鳥階段 / Individual - Final Stage": 4290, - "社群票 / Community": 3390, - "愛心優待票 / Concession": 1895, + "愛心優待票 (含紀念衣服)/ Individual - Concession": 1895, } @@ -82,6 +77,6 @@ def _compose_discord_msg(payload) -> Text: total += counts total_income += ticket_price.get(ticket_name, 0) * counts total_income = "{:,}".format(total_income) - msg += "dashboard: https://metabase.pycon.tw/question/142\n" + msg += f"dashboard: https://metabase.pycon.tw/question/142?year={YEAR}\n" msg += f"總共賣出 {total} 張喔~ (總收入 TWD${total_income})" return msg From f5063234c9c890ba2d506919d0b16e1859f2d979 Mon Sep 17 00:00:00 2001 From: Henry Lee Date: Sat, 22 Jun 2024 17:51:06 +0800 Subject: [PATCH 2/3] fix(ods): 2024 fields change --- dags/ods/kktix_ticket_orders/udfs/kktix_bq_dwd_etl.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dags/ods/kktix_ticket_orders/udfs/kktix_bq_dwd_etl.py b/dags/ods/kktix_ticket_orders/udfs/kktix_bq_dwd_etl.py index 5d2239e..708a901 100755 --- a/dags/ods/kktix_ticket_orders/udfs/kktix_bq_dwd_etl.py +++ b/dags/ods/kktix_ticket_orders/udfs/kktix_bq_dwd_etl.py @@ -199,6 +199,8 @@ "How did you know PyCon TW 2023? / 如何得知 PyCon TW 2023?": "how_did_you_know_pycon_tw", "(初次參與) How did you know PyCon TW 2023? / (Attend first time) 如何得知 PyCon TW 2023?": "how_did_you_know_pycon_tw", '(投稿者) 你是怎麼得知 PyCon Taiwan 投稿資訊?/ (For Submitter) How did you know the CfP information of PyCon Taiwan? (If you are NOT submitter, fill in "non-submitter"/ 如果您沒有投稿,請填寫「非投稿者」)': "how_did_you_know_cfp_of_pycon_tw", + # form 2024 reformatted column names + "來自國家、地區或縣市": "country_or_region", } UNWANTED_DATA_TO_UPLOAD = ( @@ -242,6 +244,8 @@ # "Size of T-shirt / 衣服尺寸 (For tickets with t-shirt should fill in this field / 票種有含紀念衣服需填寫)", """I'm willing to comply with the PyCon TW 2023 CoC / 我願意遵守 PyCon TW 2023 行為準則""", # "Have you ever been a PyCon TW volunteer? / 是否曾擔任過 PyCon TW 志工?", + # For 2024, just for notes + "地址", ) From 5200aaff4a0ff85148b77174c831a474cf337d70 Mon Sep 17 00:00:00 2001 From: Henry Lee Date: Sat, 22 Jun 2024 18:12:43 +0800 Subject: [PATCH 3/3] fix(ods): 2024 ignore fields and field need to be renamed --- dags/ods/kktix_ticket_orders/udfs/kktix_bq_dwd_etl.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dags/ods/kktix_ticket_orders/udfs/kktix_bq_dwd_etl.py b/dags/ods/kktix_ticket_orders/udfs/kktix_bq_dwd_etl.py index 708a901..723b205 100755 --- a/dags/ods/kktix_ticket_orders/udfs/kktix_bq_dwd_etl.py +++ b/dags/ods/kktix_ticket_orders/udfs/kktix_bq_dwd_etl.py @@ -201,6 +201,8 @@ '(投稿者) 你是怎麼得知 PyCon Taiwan 投稿資訊?/ (For Submitter) How did you know the CfP information of PyCon Taiwan? (If you are NOT submitter, fill in "non-submitter"/ 如果您沒有投稿,請填寫「非投稿者」)': "how_did_you_know_cfp_of_pycon_tw", # form 2024 reformatted column names "來自國家、地區或縣市": "country_or_region", + "(Attend first time) How did you know PyCon TW 2024? / (初次參與) 如何得知 PyCon TW?": "how_did_you_know_pycon_tw", + "Dietary Preference / 飲食偏好": "dietary_habit", } UNWANTED_DATA_TO_UPLOAD = ( @@ -246,6 +248,13 @@ # "Have you ever been a PyCon TW volunteer? / 是否曾擔任過 PyCon TW 志工?", # For 2024, just for notes "地址", + "聯絡人 地址", + "注意事項", + "I would like to donate invoice to Open Culture Foundation / 我願意捐贈發票給開放文化基金會 (Ref: https://reurl.cc/ZQ6VY6)", + "I’ve already read and I accept the Privacy Policy of PyCon TW 2024 / 我已閱讀並同意 PyCon TW 2024 個人資料保護聲明", + "I'm willing to comply with the PyCon TW 2024 CoC / 我願意遵守 PyCon TW 2024 行為準則", + "我願意收到未來 PyCon TW 贊助機會相關信件", + "願意收到未來 PyCon TW 活動訊息", )