Compare commits

...

2 Commits

Author SHA1 Message Date
Jonathan Kolyer fa3ba71b22 VRFS-3936 merging develop 2018-02-21 19:22:32 -08:00
Jonathan Kolyer 796ec60e1b VRFS-3936 jamtracks json send contents string, not a file proper; tweaking mobile.rake 2018-02-21 19:21:43 -08:00
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,