Bake-off #2: Alteração ao código-base
5 abril 2022, 22:33 • Augusto Esteves
Em resposta ao feedback de vários alunos, decidimos começar a
contar o tempo após a seleção do primeiro alvo (em ambas as tentativas).
Para isto, basta adicionarem else if (current_trial === 1) testStartTime = millis();
no fim de if (current_trial === trials.length)
-- originalmente no método mousePressed()
. Não é necessário removerem as instâncias originais do testStartTime
. Isto é:
// Check if the user has completed all 54 trials
if (current_trial === trials.length)
{
testEndTime = millis();
draw_targets = false; // Stop showing targets and the user performance results
printAndSavePerformance(); // Print the user's results on-screen and send these to the DB
attempt++;
// If there's an attempt to go create a button to start this
if (attempt < 2)
{
continue_button = createButton('START 2ND ATTEMPT');
continue_button.mouseReleased(continueTest);
continue_button.position(width/2 - continue_button.size().width/2, height/2 - continue_button.size().height/2);
}
}
// Check if this was the first selection in an attempt
else if (current_trial === 1) testStartTime = millis();