VRFS-3728 ios client sync api tweaks
This commit is contained in:
parent
50c3731dff
commit
53f7f29c06
|
|
@ -477,13 +477,14 @@ module JamRuby
|
|||
.where(user_id: user_id)
|
||||
.order('created_at DESC')
|
||||
.limit(1)
|
||||
jtx_created.created_at.to_i
|
||||
jtx_created.first.created_at.to_i
|
||||
end
|
||||
|
||||
def self.mixdownChecksum(user_id, jam_track_id)
|
||||
dates = JamTrackMixdown
|
||||
.select('created_at')
|
||||
.where(user_id: user_id, jam_track_id: jam_track_id)
|
||||
.order(:id)
|
||||
|
||||
dates = dates.map do |date|
|
||||
date.created_at.to_i.to_s
|
||||
|
|
|
|||
|
|
@ -106,20 +106,19 @@ class ApiJamTracksController < ApiController
|
|||
else
|
||||
# if the requested jamtrack is not purchased, send status code 204
|
||||
if 0 == JamTrack.where(id: jtid, user_id: current_user.id).count
|
||||
head(204)
|
||||
head(:no_content)
|
||||
return
|
||||
end
|
||||
end
|
||||
elsif params[:syncbuys]
|
||||
syncbuys = params[:syncbuys].to_i
|
||||
if 0 == syncbuys
|
||||
head(204)
|
||||
return
|
||||
end
|
||||
latestPurchase = JamTrack.latestPurchase(current_user.id)
|
||||
if 0 < latestPurchase && (latestPurchase < syncbuys)
|
||||
head 204, latestpurchase: latestPurchase
|
||||
if 0 == syncbuys || (0 < latestPurchase && (latestPurchase <= syncbuys))
|
||||
head :no_content, latestpurchase: latestPurchase
|
||||
return
|
||||
else
|
||||
head :ok, latestpurchase: latestPurchase
|
||||
return
|
||||
end
|
||||
end
|
||||
head(:ok)
|
||||
|
|
|
|||
Loading…
Reference in New Issue