@@ -37,7 +37,7 @@ def _get_statistics_from_bigquery() -> dict:
37
37
return result
38
38
39
39
40
- ticket_price = {
40
+ ticket_price : dict [ str , int ] = {
41
41
# please update the price for target year
42
42
"企業票 - 一般階段 / Corporate - Regular Stage" : 5800 ,
43
43
"企業票 - 晚鳥階段 / Corporate - Final Stage" : 6500 ,
@@ -55,14 +55,18 @@ def _get_statistics_from_bigquery() -> dict:
55
55
56
56
57
57
def _compose_discord_msg (payload ) -> str :
58
- msg = f"Hi 這是今天 { datetime .now ().date ()} 的票種統計資料,售票期結束後,請 follow README 的 `gcloud` 指令進去把 Airflow DAG 關掉\n \n "
58
+ msg = (
59
+ f"Hi 這是今天 { datetime .now ().date ()} 的票種統計資料,"
60
+ "售票期結束後,請 follow README 的 `gcloud` 指令進去把 Airflow DAG 關掉\n \n "
61
+ )
59
62
total = 0
60
63
total_income = 0
61
- for name , ticket_name , counts in payload :
64
+ for _ , ticket_name , counts in payload :
62
65
msg += f" * 票種:{ ticket_name } \t { counts } 張\n "
63
66
total += counts
64
67
total_income += ticket_price .get (ticket_name , 0 ) * counts
65
- total_income = f"{ total_income :,} "
66
- msg += f"dashboard: https://metabase.pycon.tw/question/142?year={ YEAR } \n "
67
- msg += f"總共賣出 { total } 張喔~ (總收入 TWD${ total_income } )"
68
+ msg = (
69
+ f"{ msg } dashboard: https://metabase.pycon.tw/question/142?year={ YEAR } \n "
70
+ f"總共賣出 { total } 張喔~ (總收入 TWD${ total_income :,} )"
71
+ )
68
72
return msg
0 commit comments