VRFS-3936 jamtracks json send contents string, not a file proper; tweaking mobile.rake
This commit is contained in:
parent
91da29088f
commit
796ec60e1b
|
|
@ -78,10 +78,11 @@ class ApiSearchController < ApiController
|
||||||
SampleApp::Application.load_tasks
|
SampleApp::Application.load_tasks
|
||||||
Rake::Task["mobile:jam_tracks_json"].invoke
|
Rake::Task["mobile:jam_tracks_json"].invoke
|
||||||
end
|
end
|
||||||
render(file: fname)
|
json = JSON.parse(File.read(fname))
|
||||||
|
render(json: json, status: 200)
|
||||||
|
|
||||||
else
|
else
|
||||||
render(json: {}, status: 200)
|
render(json: {})
|
||||||
end
|
end
|
||||||
|
|
||||||
elsif request.post?
|
elsif request.post?
|
||||||
|
|
|
||||||
|
|
@ -114,13 +114,18 @@ namespace :mobile do
|
||||||
jtname = row[1]
|
jtname = row[1]
|
||||||
jt = JamTrack.
|
jt = JamTrack.
|
||||||
where(name: jtname, original_artist: jtartist).
|
where(name: jtname, original_artist: jtartist).
|
||||||
|
includes([:genres, { jam_track_tracks: :instrument }]).
|
||||||
limit(1).
|
limit(1).
|
||||||
first
|
first
|
||||||
next if jt.blank?
|
next if jt.blank?
|
||||||
|
|
||||||
jtdata = {
|
jtdata = {
|
||||||
artist: jtartist,
|
artist: jtartist,
|
||||||
genre: jt.genres.map(&:description).join(', '),
|
genre: jt.genres.map(&:description).join(', '),
|
||||||
|
instruments: jt.jam_track_tracks.map(&:instrument).compact.uniq.map(&:description).join(', '),
|
||||||
|
language: jt.language,
|
||||||
|
version: jt.version,
|
||||||
|
price: jt.price,
|
||||||
id: jt.id,
|
id: jt.id,
|
||||||
key: jt.id,
|
key: jt.id,
|
||||||
name: jtname,
|
name: jtname,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue