Merged in VRFS-3936 (pull request #2)

VRFS-3936 jamtracks json send contents string, not a file proper; tweaking mobile.rake
This commit is contained in:
Seth Call 2018-03-05 04:24:48 +00:00
parent f00949b414
commit 16d8e0fffe
2 changed files with 9 additions and 3 deletions

View File

@ -78,10 +78,11 @@ class ApiSearchController < ApiController
SampleApp::Application.load_tasks
Rake::Task["mobile:jam_tracks_json"].invoke
end
render(file: fname)
json = JSON.parse(File.read(fname))
render(json: json, status: 200)
else
render(json: {}, status: 200)
render(json: {})
end
elsif request.post?

View File

@ -114,13 +114,18 @@ namespace :mobile do
jtname = row[1]
jt = JamTrack.
where(name: jtname, original_artist: jtartist).
includes([:genres, { jam_track_tracks: :instrument }]).
limit(1).
first
next if jt.blank?
jtdata = {
artist: jtartist,
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,
key: jt.id,
name: jtname,