Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

Presentation and Feedback Condition ".*" regex fails to match tagless AssignmentExercises #300

Open
kevinburleigh75 opened this issue Sep 10, 2013 · 1 comment

Comments

@kevinburleigh75
Copy link
Contributor

When a PresentationCondition or FeedbackCondition has the .* regex, the intent is to match ANY AssignmentExercise. However, when the AE has no tags at all, the following PresentationCondition/LearningCondition test fails when labels.any? returns []:

  def applies_to?(student_or_assignment_exercise)
    label_regex_array = label_regex.split(",").collect{|lr| lr.strip}

    if student_or_assignment_exercise.instance_of? StudentExercise
      assignment_exercise = student_or_assignment_exercise.assignment_exercise
    else
      assignment_exercise = student_or_assignment_exercise
    end

    labels = assignment_exercise.tag_list

    label_regex_array.any? do |regex|
      labels.any? do |label|
        label == regex || label.match(Regexp.new(regex, Regexp::IGNORECASE))
      end
    end
  end
@kevinburleigh75
Copy link
Contributor Author

It is possible that this is now the desired behavior, now that the default PC/FC can be easily viewed and edited. However, it should still be made clear to users that unlabeled exercises will not be matched by any regex.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant