Skip to content

Commit

Permalink
Merge pull request #1312 from Amsterdam-Music-Lab/bugfix/categorization
Browse files Browse the repository at this point in the history
Fix #1308: adjust categorization rules file
  • Loading branch information
BeritJanssen authored Oct 18, 2024
2 parents 4061f91 + 1e861f1 commit d56b69f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions backend/experiment/rules/categorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,16 @@ def get_intro_explainer(self):
)

def next_round(self, session: Session):
if session.get_rounds_passed() == 0:
json_data = session.load_json_data()

if json_data.get("started"):
actions = [self.get_intro_explainer()]
questions = self.get_open_questions(session)
if questions:
actions.extend(questions)
session.save_json_data({"started": True})
return actions

json_data = session.load_json_data()

# Plan experiment on the first call to next_round
if not json_data.get("phase"):
json_data = self.plan_experiment(session)
Expand Down Expand Up @@ -465,7 +466,7 @@ def next_trial_action(self, session):
# Retrieve next section in the sequence
rounds_passed = session.get_rounds_passed() - int(json_data["training_rounds"])
sequence = json_data["sequence"]
this_section = sequence[get_rounds_passed]
this_section = sequence[rounds_passed]
section = session.playlist.get_section(song_ids=[this_section])
# Determine expected response
if section.tag == "1A" or section.tag == "2A":
Expand All @@ -492,7 +493,7 @@ def next_trial_action(self, session):
def get_title(self, session):
json_data = session.load_json_data()
rounds_passed = session.get_rounds_passed() - int(json_data["training_rounds"]) + 1
return f"Round {get_rounds_passed} / {len(json_data['sequence'])}"
return f"Round {rounds_passed} / {len(json_data['sequence'])}"


repeat_training_or_quit = ChoiceQuestion(
Expand Down

0 comments on commit d56b69f

Please sign in to comment.