File size: 3,346 Bytes
115ff47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
587e7b0
115ff47
1679f35
 
 
50790a7
 
 
 
 
 
 
 
1679f35
50790a7
 
 
 
 
115ff47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f73342b
115ff47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d956e14
115ff47
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import json

import gradio as gr


def get_llm_response(completion_reward, *args):
    return completion_reward.get_llm_response(*args)


def set_player_name(completion_reward, *args):
    return completion_reward.set_player_name(*args)


def display_class_info(completion_reward, *args):
    return completion_reward.display_class_info(*args)


def set_player_selected_character(completion_reward, *args):
    return completion_reward.set_player_selected_character(*args)


def create_certificate(completion_reward, *args):
    return completion_reward.create_certificate(*args)


def complete_reward(completion_reward, *args):
    return completion_reward.complete_reward(*args)


def check_is_in_completion_reward(player_backend_user_id):
    with open("./data/completion_reward_issue_status.json") as f:
        completion_reward_issue_status_dict = json.load(f)
        completion_reward_issue_status_dict["[email protected]"] = "not_issued"
        completion_reward_issue_status_dict["http://googleid.junyiacademy.org/115084976189396533674"] = "not_issued"
        completion_reward_issue_status_dict["http://googleid.junyiacademy.org/106428943548495187296"] = "not_issued"
        
    preview_list = [
        "[email protected]",
        "[email protected]",
        "http://googleid.junyiacademy.org/111939868185365078143",
        "http://googleid.junyiacademy.org/107407156051367422051",
        "http://googleid.junyiacademy.org/115084976189396533674",
        "http://googleid.junyiacademy.org/106428943548495187296",
        "http://id.junyiacademy.org/28f0f5bb784441c58ad4bafad00a2c3d",
    ]


    if player_backend_user_id in completion_reward_issue_status_dict or player_backend_user_id in preview_list:
        
        if player_backend_user_id in preview_list:
            value = completion_reward_issue_status_dict[player_backend_user_id]
            if value == "not_issued":
                return (
                    gr.update(visible=False),
                    gr.update(visible=True),
                    gr.update(visible=True),
                    gr.update(visible=True),
                    gr.update(visible=False),
                    gr.update(visible=False),
                    gr.update(visible=False),
                )
            else:
                return (
                    gr.update(visible=False),
                    gr.update(visible=False),
                    gr.update(visible=False),
                    gr.update(visible=False),
                    gr.update(visible=False),
                    gr.update(visible=False),
                    gr.Image(value, visible=True, elem_id="certificate"),
                )
        else:
            return (
                gr.update(visible=False),
                gr.update(visible=False),
                gr.update(visible=False),
                gr.update(visible=False),
                gr.update(visible=False),
                gr.update(visible=True),
                gr.update(visible=False),
            )

    else:
        return (
            gr.update(visible=False),
            gr.update(visible=False),
            gr.update(visible=False),
            gr.update(visible=False),
            gr.update(visible=True),
            gr.update(visible=False),
            gr.update(visible=False),
        )