diff --git a/sliders/__init__.py b/sliders/__init__.py index 4f857ba..49d4867 100644 --- a/sliders/__init__.py +++ b/sliders/__init__.py @@ -234,14 +234,6 @@ def play_game(player: Player, message: dict): ) } - if message_type == "cheat" and settings.DEBUG: - return { - my_id: dict( - type="solution", - solution={s.idx: s.target for s in Slider.filter(puzzle=puzzle)}, - ) - } - raise RuntimeError("unrecognized message from client") diff --git a/sliders/static/sliders.js b/sliders/static/sliders.js index ce2fcb3..b7f3b34 100644 --- a/sliders/static/sliders.js +++ b/sliders/static/sliders.js @@ -172,10 +172,6 @@ class Controller { case 'feedback': this.recvFeedback(message); break; - - case 'solution': - this.cheat(message.solution); - break; } if ('progress' in message) { // can be added to message of any type @@ -270,16 +266,6 @@ class Controller { endGame() { document.getElementById("form").submit(); } - - cheat(values) { - let i = 0, cnt=Object.keys(values).length; - let timer = window.setInterval(() => { - this.model.sliders[i].value = values[i]; - this.submitSlider(i); - i++; - if (i == cnt) window.clearInterval(timer); - }, js_vars.params.retry_delay * 1000 + 100); - } } window.onload = (event) => { diff --git a/sliders/static/sliders_cheating.js b/sliders/static/sliders_cheating.js deleted file mode 100644 index 22a4d54..0000000 --- a/sliders/static/sliders_cheating.js +++ /dev/null @@ -1,8 +0,0 @@ -let cheat_btn = document.getElementById('cheat-btn'); -cheat_btn.onclick = function() { - liveSend({'type': 'cheat'}); -} - -function cheat(solution) { - input.value = solution; -} diff --git a/sliders/tests.py b/sliders/tests.py index c932fbc..7c6278b 100644 --- a/sliders/tests.py +++ b/sliders/tests.py @@ -1,7 +1,6 @@ import time from contextlib import contextmanager -from otree import settings from otree.api import Bot, Submission, expect from . import Game, Puzzle, Results, Slider @@ -176,9 +175,6 @@ def call_live_method(method, group, case, **kwargs): # noqa print(" - testing skipping") test_skipping(method, player, puzzle, current_slider, num_correct) - print(" - testing cheating") - test_cheat_nodebug(method, player) - def test_unsuccessful_attempt(method, player, puzzle, slider, num_correct): target = get_target(puzzle, slider) @@ -308,13 +304,3 @@ def test_skipping(method, player, puzzle, slider, num_correct): expect_puzzle( get_last_puzzle(player), iteration=1, num_correct=num_correct, is_solved=False ) - - -def test_cheat_nodebug(method, player): - debug_old = settings.DEBUG - settings.DEBUG = False - - with expect_failure(RuntimeError): - send(method, player, "cheat") - - settings.DEBUG = debug_old