Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

no fields are happy fields

  • Loading branch information...
commit 418980ae20fd401edece7aba8256c10d8fe28f8e 1 parent 0060d31
Kacper Why authored
Showing with 6 additions and 5 deletions.
  1. +3 −2 web/hangover.lua
  2. +3 −3 web/lib/tracks.lua
5 web/hangover.lua
View
@@ -57,11 +57,12 @@ function get_db(web,...)
local result, size = tracks:search(query, qf)
local pages = math.floor(size/limit)+1
+ print('got query: '.. u.dump(web.GET).. ' result: '.. u.dump(result))
+
if fields then
fields = u.split(fields)
- else
- fields = tracks.fields(result);
end
+ print("splitting fields: "..u.dump(fields))
result = tracks.filter(result, fields, limit, skip)
return json.encode({{fields=fields,pages=pages,result=result}}).."\n"
end
6 web/lib/tracks.lua
View
@@ -194,12 +194,12 @@ function tracks.filter(result, fields, limit, skip)
break
end
if(c > skip) then
- if #fields == 0 then
- one = v
+ if not fields or #fields == 0 then
+ one = v -- no fields, so all fields
else
local one = {}
for i,f in pairs(fields) do
- one[f] = v[f]
+ one[f] = v[f] -- just these fields
end
end
res[k] = one
Please sign in to comment.
Something went wrong with that request. Please try again.