Sha256: 89b355a9de7261e566006e7be3d7d71a74c4f7eaded4619005e712ed9c3e38bc
Contents?: true
Size: 1.16 KB
Versions: 27
Compression:
Stored size: 1.16 KB
Contents
class Problem < QueriableChallenge include WithExpectations, WithEditor, Solvable markdown_on :corollary validate :ensure_evaluation_criteria name_model_as Exercise def setup_query_assignment!(assignment) end def save_query_results!(assignment) end def reset! super self.test = nil self.expectations = [] end def expectations own_expectations + guide_expectations end def custom_expectations "#{own_custom_expectations}\n#{guide_custom_expectations}" end def guide_expectations guide.expectations end def guide_custom_expectations guide.custom_expectations end def evaluation_criteria? manual_evaluation? || expectations? || test.present? end def expectations? own_expectations.present? || own_custom_expectations.present? end # Sets the layout. This method accepts input_kids as a synonym of input_primary # for historical reasons def layout=(layout) self[:layout] = layout.like?(:input_kids) ? :input_primary : layout end private def ensure_evaluation_criteria errors.add :base, :evaluation_criteria_required unless evaluation_criteria? end end
Version data entries
27 entries across 27 versions & 2 rubygems