diff --git a/app/models/annotation.rb b/app/models/annotation.rb index 66b58e6..8ea44dd 100644 --- a/app/models/annotation.rb +++ b/app/models/annotation.rb @@ -1,5 +1,5 @@ class Annotation < ActiveRecord::Base - enum type: [ :guidance, :example_answer] + enum type: [ :example_answer, :guidance] ## # Associations belongs_to :org diff --git a/app/views/phases/_answer_form.html.erb b/app/views/phases/_answer_form.html.erb index abee475..4c645fc 100644 --- a/app/views/phases/_answer_form.html.erb +++ b/app/views/phases/_answer_form.html.erb @@ -32,8 +32,8 @@ <%= raw question.text %> - <% if question.annotations.where('type <> ?',Annotation.types[:example_answer]).any? %> - <% annotation = question.annotations.where('type <> ?',Annotation.types[:example_answer]).order(:created_at).first %> + <% if question.annotations.where(type: Annotation.types[:example_answer]).any? %> + <% annotation = question.annotations.where(type: Annotation.types[:example_answer]).order(:created_at).first %> <% if annotation.text.present? %>
diff --git a/app/views/questions/_preview_question.html.erb b/app/views/questions/_preview_question.html.erb index e4a86a8..da593ea 100644 --- a/app/views/questions/_preview_question.html.erb +++ b/app/views/questions/_preview_question.html.erb @@ -57,8 +57,8 @@ <% end %> - <% if question.annotations.where('type <> ?',Annotation.types[:example_answer]).any? %> - <% annotation = question.annotations.where('type <> ?',Annotation.types[:example_answer]).order(:created_at).first %> + <% if question.annotations.where(type: Annotation.types[:example_answer]).any? %> + <% annotation = question.annotations.where(type: Annotation.types[:example_answer]).order(:created_at).first %>
<%= _('Example of answer')%> diff --git a/app/views/templates/_edit_annotations.html.erb b/app/views/templates/_edit_annotations.html.erb index d388f61..443f6cb 100644 --- a/app/views/templates/_edit_annotations.html.erb +++ b/app/views/templates/_edit_annotations.html.erb @@ -47,7 +47,7 @@ <%= _('Example of Answer')%>
- <% annotations = question.annotations.where(org_id: current_user.org_id).where('type <> ?',Annotation.types[:example_answer]).order(:created_at).first %> + <% annotations = question.annotations.where(org_id: current_user.org_id).where(type: Annotation.types[:example_answer]).order(:created_at).first %> <% if annotations.nil? %> <% annotations = question.annotations.build %> <% end %>