fix feedback session logging
This commit is contained in:
parent
05617add98
commit
c04be87f53
|
@ -4,27 +4,27 @@ class Public::ConferenceFeedbacksController < Public::ApplicationController
|
||||||
@unrated_events = @conference.events
|
@unrated_events = @conference.events
|
||||||
.joins(:proposition).approved
|
.joins(:proposition).approved
|
||||||
.joins("LEFT JOIN feedbacks ON feedbacks.feedback_receiving_id = events.id AND feedbacks.feedback_receiving_type = 'Event'")
|
.joins("LEFT JOIN feedbacks ON feedbacks.feedback_receiving_id = events.id AND feedbacks.feedback_receiving_type = 'Event'")
|
||||||
.where("feedbacks.session_id != ? OR feedbacks.id IS NULL", session.id).distinct
|
.where("feedbacks.session_id != ? OR feedbacks.id IS NULL", session.id.to_s).distinct
|
||||||
|
|
||||||
@rated_events = @conference.events
|
@rated_events = @conference.events
|
||||||
.joins(:proposition).approved
|
.joins(:proposition).approved
|
||||||
.joins(:feedbacks)
|
.joins(:feedbacks)
|
||||||
.where(feedbacks: {session_id: session.id}).distinct
|
.where(feedbacks: {session_id: session.id.to_s}).distinct
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
if current_conference.feedbacks.where(session_id: session.id).exists?
|
if current_conference.feedbacks.where(session_id: session.id.to_s).exists?
|
||||||
@feedback = current_conference.feedbacks.where(session_id: session.id).order(updated_at: :asc).last
|
@feedback = current_conference.feedbacks.where(session_id: session.id.to_s).order(updated_at: :asc).last
|
||||||
else
|
else
|
||||||
@feedback = current_conference.feedbacks.build
|
@feedback = current_conference.feedbacks.build
|
||||||
@feedback.author_email = Feedback.where(session_id: session.id).order(updated_at: :asc).last.try(:author_email)
|
@feedback.author_email = Feedback.where(session_id: session.id.to_s).order(updated_at: :asc).last.try(:author_email)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@feedback = current_conference.feedbacks.build(feedback_params)
|
@feedback = current_conference.feedbacks.build(feedback_params)
|
||||||
@feedback.ip_address = request.remote_ip
|
@feedback.ip_address = request.remote_ip
|
||||||
@feedback.session_id = session.id
|
@feedback.session_id = session.id.to_s
|
||||||
|
|
||||||
if @feedback.save
|
if @feedback.save
|
||||||
flash[:notice] = I18n.t("public.conference_feedbacks.new.success")
|
flash[:notice] = I18n.t("public.conference_feedbacks.new.success")
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
class Public::EventFeedbacksController < Public::ApplicationController
|
class Public::EventFeedbacksController < Public::ApplicationController
|
||||||
def new
|
def new
|
||||||
if event.feedbacks.where(session_id: session.id).exists?
|
if event.feedbacks.where(session_id: session.id.to_s).exists?
|
||||||
@feedback = event.feedbacks.where(session_id: session.id).order(updated_at: :asc).last
|
@feedback = event.feedbacks.where(session_id: session.id.to_s).order(updated_at: :asc).last
|
||||||
else
|
else
|
||||||
@feedback = event.feedbacks.build
|
@feedback = event.feedbacks.build
|
||||||
@feedback.author_email = Feedback.where(session_id: session.id).order(updated_at: :asc).last.try(:author_email)
|
@feedback.author_email = Feedback.where(session_id: session.id.to_s).order(updated_at: :asc).last.try(:author_email)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@feedback = event.feedbacks.build(feedback_params)
|
@feedback = event.feedbacks.build(feedback_params)
|
||||||
@feedback.ip_address = request.remote_ip
|
@feedback.ip_address = request.remote_ip
|
||||||
@feedback.session_id = session.id
|
@feedback.session_id = session.id.to_s
|
||||||
|
|
||||||
if @feedback.save
|
if @feedback.save
|
||||||
flash[:notice] = I18n.t("public.event_feedbacks.new.success")
|
flash[:notice] = I18n.t("public.event_feedbacks.new.success")
|
||||||
|
|
|
@ -5,7 +5,7 @@ h1.entry-title = t('.feedback_for_the_conference')
|
||||||
p = t('.feedback_incentive')
|
p = t('.feedback_incentive')
|
||||||
|
|
||||||
ul
|
ul
|
||||||
- if @conference.feedbacks.where(session_id: session.id).exists?
|
- if @conference.feedbacks.where(session_id: session.id.to_s).exists?
|
||||||
li = link_to t('.change_general_feedback_for', title: @conference.title), new_conference_feedback_path
|
li = link_to t('.change_general_feedback_for', title: @conference.title), new_conference_feedback_path
|
||||||
- else
|
- else
|
||||||
li = link_to t('.general_feedback_for', title: @conference.title), new_conference_feedback_path
|
li = link_to t('.general_feedback_for', title: @conference.title), new_conference_feedback_path
|
||||||
|
|
Loading…
Reference in New Issue