Skip to content

[QTI] Perseus archive of an exercise with raw Perseus questions keeps legacy input questions whose answers are not numbers #6276

Description

@rtibblesbot

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

An exercise holding a legacy perseus_question and no native QTI item publishes only a Perseus archive. A legacy input question in it whose accepted answers Perseus can't read as a finite number (Sphere, +3, 1E3, 1e400) becomes a numeric-input with answers: [], which nothing a learner enters can satisfy. #6210 leaves the blank-answer ones out and excludes these; #6273 sends mixed native QTI exercises holding them to QTI only, where they publish as text entries.

Complexity: Low
Target branch: unstable

Context

  • An exercise with a perseus_question and no native QTI item gets PerseusExerciseGenerator only:
    elif any_perseus_question:
    generator_classes = [PerseusExerciseGenerator]
  • _process_input_answers drops every answer extract_value does not read as a number:
    def _process_input_answers(self, processed_data):
    """Extract input answer processing logic"""
    non_empty_answers = []
    for answer in processed_data["answers"]:
    answer["answer"] = extract_value(answer["answer"])
    if answer["answer"] or answer["answer"] == 0:
    non_empty_answers.append(answer)
    return {**processed_data, "answers": non_empty_answers}
  • An exercise with a perseus_question and one legacy input question, published on unstable and with Publish mixed exercises QTI only when Perseus can't read a legacy input answer #6273:
    input answer   unstable                     with #6273
    "Sphere"       numeric-input, answers []    numeric-input, answers []
    "+3"           numeric-input, answers []    numeric-input, answers []
    "1E3"          numeric-input, answers []    numeric-input, answers []
    "1e400"        item JSON does not parse     numeric-input, answers []
    

The Change

How to Get There

  • Publish an exercise holding one legacy perseus_question and one legacy input question answered Sphere, then read the input question's item JSON in the .perseus file.

Acceptance Criteria

  • In an exercise holding a legacy perseus_question, a legacy input question answered ["+3"] or ["1E3"] publishes in the Perseus archive with numeric-input answers [3] or [1000].
  • An exercise holding a legacy perseus_question and a legacy input question answered ["Sphere"] or ["1e400"] publishes a QTI package holding both questions and no Perseus archive.
  • No published file serves a legacy input question as a numeric-input with answers: [].
  • The published node's AssessmentMetaData.assessment_item_ids lists only items its published files contain.
  • test_exportchannel.py covers those exercises.

AI usage

Claude Code found this during an automated self-review of #6273, reproduced it with a scratch publish test on unstable and on that branch, and drafted this issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions