From af4678cbed58a53735d6f9f7fbfbe8db1eba1417 Mon Sep 17 00:00:00 2001 From: Jonathan Kolyer Date: Mon, 24 Apr 2017 11:21:11 -0700 Subject: [PATCH] VRFS-3936 mobile purchase sync fixes --- web/app/controllers/api_jam_tracks_controller.rb | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/web/app/controllers/api_jam_tracks_controller.rb b/web/app/controllers/api_jam_tracks_controller.rb index 13a6723a6..ff7cbf6f2 100644 --- a/web/app/controllers/api_jam_tracks_controller.rb +++ b/web/app/controllers/api_jam_tracks_controller.rb @@ -102,7 +102,6 @@ class ApiJamTracksController < ApiController if params[:mixcheck] checksum = JamTrackMixdown.mixdownChecksum(current_user.id, jtid) head :ok, checksum: checksum - return else # 204: nothing purchased for user # 200: jamtrack purchase for user confirmed @@ -111,21 +110,12 @@ class ApiJamTracksController < ApiController .limit(1) .blank? head(:no_content) - return end end - elsif params[:syncbuys] - syncbuys = params[:syncbuys].to_i - latestPurchase = JamTrack.latestPurchase(current_user.id) - if 0 == syncbuys || (0 < latestPurchase && (latestPurchase <= syncbuys)) - head :no_content, latestpurchase: latestPurchase - return - else - head :ok, latestpurchase: latestPurchase - return - end + elsif params[:syncbuys].present? + head :ok, purchasecount: JamTrackRight.where(user_id: current_user.id).count end - head(:ok) + head(:ok) unless performed? end def purchased