From 871a3a7214ca8381bf29e47d1c79c7736f871798 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Thu, 23 Apr 2015 14:35:39 +0100 Subject: Move existing track logic to controller --- app/controllers/widgets_controller.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/controllers/widgets_controller.rb') diff --git a/app/controllers/widgets_controller.rb b/app/controllers/widgets_controller.rb index 2385855b1..04378a724 100644 --- a/app/controllers/widgets_controller.rb +++ b/app/controllers/widgets_controller.rb @@ -16,6 +16,10 @@ class WidgetsController < ApplicationController @track_thing = TrackThing.create_track_for_request(@info_request) @status = @info_request.calculate_status @count = @info_request.track_things.count + @info_request.widget_votes.count + 1 + + if @user + @existing_track = TrackThing.find_existing(@user, @track_thing) + end unless @user or cookies[:widget_vote] cookies.permanent[:widget_vote] = SecureRandom.hex(10) end -- cgit v1.2.3