aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/widgets_controller.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2015-04-23 14:35:39 +0100
committerLouise Crow <louise.crow@gmail.com>2015-04-28 09:07:27 +0100
commit871a3a7214ca8381bf29e47d1c79c7736f871798 (patch)
treea70ca88db9dea78c087ee17d80b76c6721d9346f /app/controllers/widgets_controller.rb
parent080e9210cae1353f16449e3aff5f18ca62ee8a32 (diff)
Move existing track logic to controller
Diffstat (limited to 'app/controllers/widgets_controller.rb')
-rw-r--r--app/controllers/widgets_controller.rb4
1 files changed, 4 insertions, 0 deletions
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