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 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?

View File

@ -114,6 +114,7 @@ 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?
@ -121,6 +122,10 @@ namespace :mobile do
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,