diff --git a/flask/testapp/static/javascript/beautyVote.js b/flask/testapp/static/javascript/beautyVote.js index fb34d9e..74e43b2 100644 --- a/flask/testapp/static/javascript/beautyVote.js +++ b/flask/testapp/static/javascript/beautyVote.js @@ -55,7 +55,7 @@ case GAME_SCENE: if(timer > TIME_LIMIT){ player.choice = E; - postForm(player.choice) // 送信用 + sendChoice(player.choice) // 変更 checkAnswer(); break; } @@ -217,7 +217,7 @@ function sendName(){ xhr.open('POST', '/form'); xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded;charset=UTF-8'); - xhr.send('originalname=' + player.name); //変更 + xhr.send('originalnme=' + player.name); //変更 xhr.onreadystatechange = function() { //受信用 if (xhr.readyState === 4 && xhr.status === 200) { if(xhr.responseText!="Data received successfully"){ diff --git a/flask/testapp/views.py b/flask/testapp/views.py index 453c3fc..c3b0f53 100644 --- a/flask/testapp/views.py +++ b/flask/testapp/views.py @@ -48,9 +48,9 @@ print("Received choice:", choices) if len(choices) >= user_number: print("集計...") - most_common_option = calculate_majority(choices) # 追記 + most_common_option = calculate_majority(choices) # nemoto追記 choices.clear() - return most_common_option # 追記 + return most_common_option # nemoto追記 # ゲーム開始時にユーザー数を出しておき,それぞれに識別番号を振る if request.form.get("originalname"): @@ -69,9 +69,9 @@ # 識別番号を取得 user_number = int(request.form.get("number")) # スコアを取得 - score = int(request.form.get("score")) # 変更 + score = int(request.form.get("score")) # nemoto変更 data[user_number] = score - scores_order, user_number_order = calculate_order(data) # 追記 + scores_order, user_number_order = calculate_order(data) # nemoto追記 print( "Received number:", user_number, @@ -94,7 +94,7 @@ return "Data received successfully" -# 多数派の計算(追記) +# 多数派の計算(nemoto追記) def calculate_majority(get_data): counter = Counter(get_data) # 最も多く出現する要素を取得する @@ -102,7 +102,7 @@ return get_most_common_option -# ランキング上位の計算(追記) +# ランキング上位の計算(nemoto追記) def calculate_order(get_data): get_sorted_numbers_with_indices = sorted(enumerate(get_data), key=lambda x: x[1], reverse=True) get_scores = [item[1] for item in get_sorted_numbers_with_indices]