ChenyuRabbitLove commited on
Commit
9747876
1 Parent(s): 45c60d5

bugfix: fix minor bugs

Browse files
Files changed (2) hide show
  1. app.py +69 -68
  2. utils/completion_reward_utils.py +1 -1
app.py CHANGED
@@ -79,78 +79,79 @@ with gr.Blocks(theme=seafoam, css=get_content("css/style.css")) as demo:
79
  completion_reward = gr.State(init_reward)
80
  player_activity_tracker = gr.State(create_new_player_activity)
81
 
82
- with gr.Row():
83
- with gr.Column(
84
- scale=1,
85
- elem_classes="gallery_container",
86
- ):
87
- pet_description = gr.Markdown("# 夥伴", elem_id="pet_avatar_description")
88
- pet_gallery = gr.Gallery(
89
- [],
90
- label="夥伴",
91
- preview=False,
92
- elem_id="pet_gallery",
93
- columns=30,
94
- height=200,
95
- )
96
-
97
- badge_description = gr.Markdown("# 徽章", elem_id="badge_avatar_description")
98
- badge_gallery = gr.Gallery(
99
- [],
100
- label="徽章",
101
- preview=False,
102
- elem_id="badge_gallery",
103
- columns=30,
104
- height=200,
105
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
- with gr.Column(scale=1, elem_id="player_avatar_container"):
108
- avatar = gr.Image(
109
- "avatar/blank_avatar.png",
110
- elem_id="player_avatar",
111
- )
112
- avatar_description = gr.Markdown(
113
- "# 光束守護者", elem_id="player_avatar_description"
114
  )
 
115
 
116
- with gr.Column(scale=1):
117
- adventure_description = gr.Markdown(
118
- "# 冒險階段", elem_id="adventure_description"
119
- )
120
- adventure = gr.Slider(
121
- value=0,
122
- show_label=False,
123
- interactive=False,
124
- elem_id="adventure_slider",
125
- info="",
126
- )
127
- achievements_description = gr.Markdown(
128
- "# 達成成就", elem_id="achievements_description"
129
- )
130
- achievements = gr.HighlightedText(
131
- value=[],
132
- elem_classes="achievements",
133
- color_map={
134
- "完成": "green",
135
- "未完成": "red",
136
- },
137
  )
138
-
139
- with gr.Row():
140
- html = (
141
- "<div style='max-width:100%; max-height:360px; overflow:auto'>"
142
- + get_content("htmls/adventure_blank.html")
143
- )
144
- adventure_log = gr.HTML(html, label="Adventure Log", elem_id="adventure_log")
145
-
146
- # handling player info
147
- with gr.Row():
148
- player_backend_id = gr.Textbox("", elem_id="player_backend_id", visible=False)
149
- player_info_query_btn = gr.Button(
150
- "Query", elem_id="trigger_button", visible=False
151
- )
152
- pull_newest_player_data = gr.Textbox("", visible=False)
153
- update_status = gr.Textbox("", visible=False)
154
 
155
  with gr.Tab("完賽獎勵"):
156
  with gr.Row():
 
79
  completion_reward = gr.State(init_reward)
80
  player_activity_tracker = gr.State(create_new_player_activity)
81
 
82
+ with gr.Tab("個人化戰報"):
83
+ with gr.Row():
84
+ with gr.Column(
85
+ scale=1,
86
+ elem_classes="gallery_container",
87
+ ):
88
+ pet_description = gr.Markdown("# 夥伴", elem_id="pet_avatar_description")
89
+ pet_gallery = gr.Gallery(
90
+ [],
91
+ label="夥伴",
92
+ preview=False,
93
+ elem_id="pet_gallery",
94
+ columns=30,
95
+ height=200,
96
+ )
97
+
98
+ badge_description = gr.Markdown("# 徽章", elem_id="badge_avatar_description")
99
+ badge_gallery = gr.Gallery(
100
+ [],
101
+ label="徽章",
102
+ preview=False,
103
+ elem_id="badge_gallery",
104
+ columns=30,
105
+ height=200,
106
+ )
107
+
108
+ with gr.Column(scale=1, elem_id="player_avatar_container"):
109
+ avatar = gr.Image(
110
+ "avatar/blank_avatar.png",
111
+ elem_id="player_avatar",
112
+ )
113
+ avatar_description = gr.Markdown(
114
+ "# 光束守護者", elem_id="player_avatar_description"
115
+ )
116
+
117
+ with gr.Column(scale=1):
118
+ adventure_description = gr.Markdown(
119
+ "# 冒險階段", elem_id="adventure_description"
120
+ )
121
+ adventure = gr.Slider(
122
+ value=0,
123
+ show_label=False,
124
+ interactive=False,
125
+ elem_id="adventure_slider",
126
+ info="",
127
+ )
128
+ achievements_description = gr.Markdown(
129
+ "# 達成成就", elem_id="achievements_description"
130
+ )
131
+ achievements = gr.HighlightedText(
132
+ value=[],
133
+ elem_classes="achievements",
134
+ color_map={
135
+ "完成": "green",
136
+ "未完成": "red",
137
+ },
138
+ )
139
 
140
+ with gr.Row():
141
+ html = (
142
+ "<div style='max-width:100%; max-height:360px; overflow:auto'>"
143
+ + get_content("htmls/adventure_blank.html")
 
 
 
144
  )
145
+ adventure_log = gr.HTML(html, label="Adventure Log", elem_id="adventure_log")
146
 
147
+ # handling player info
148
+ with gr.Row():
149
+ player_backend_id = gr.Textbox("", elem_id="player_backend_id", visible=False)
150
+ player_info_query_btn = gr.Button(
151
+ "Query", elem_id="trigger_button", visible=False
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  )
153
+ pull_newest_player_data = gr.Textbox("", visible=False)
154
+ update_status = gr.Textbox("", visible=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
 
156
  with gr.Tab("完賽獎勵"):
157
  with gr.Row():
utils/completion_reward_utils.py CHANGED
@@ -32,7 +32,7 @@ def check_is_in_completion_reward(player_backend_user_id):
32
  completion_reward_issue_status_dict = json.load(f)
33
 
34
  if player_backend_user_id in completion_reward_issue_status_dict:
35
- preview_list = ["[email protected]", "http://googleid.junyiacademy.org/111939868185365078143"]
36
  if player_backend_user_id in preview_list:
37
  value = completion_reward_issue_status_dict[player_backend_user_id]
38
  if value == "not_issued":
 
32
  completion_reward_issue_status_dict = json.load(f)
33
 
34
  if player_backend_user_id in completion_reward_issue_status_dict:
35
+ preview_list = ["[email protected]", "http://googleid.junyiacademy.org/111939868185365078143", "http://googleid.junyiacademy.org/107407156051367422051"]
36
  if player_backend_user_id in preview_list:
37
  value = completion_reward_issue_status_dict[player_backend_user_id]
38
  if value == "not_issued":