Skip to content

Commit

Permalink
Addressing issue with getting unique column values throwin error beca…
Browse files Browse the repository at this point in the history
…use returned type is inconsistent probably due to caching.
  • Loading branch information
alexsielicki committed Mar 31, 2017
1 parent a53b75d commit bbb61cd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/slycat/web/server/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1314,9 +1314,15 @@ def get_model_arrayset_metadata(mid, aid, **kwargs):
if "unique" in results:
cherrypy.log.error("found unique in results: " )
cherrypy.log.error( '\n'.join(str(p) for p in results["unique"]) )
cherrypy.log.error("type:")
cherrypy.log.error(str(type(results["unique"][0]['values'][0])))
for unique in results["unique"]:
unique["values"] = [list_of_values for list_of_values in unique["values"]]
# unique["values"] = [array.tolist() for array in unique["values"]]
# Maybe due to caching, sometimes the result comes back as a 'list'
if type(results["unique"][0]['values'][0]) is list:
unique["values"] = [list_of_values for list_of_values in unique["values"]]
# Other times it's a 'numpy.ndarray'
else:
unique["values"] = [array.tolist() for array in unique["values"]]
cherrypy.log.error("returning results")

return results
Expand Down

0 comments on commit bbb61cd

Please sign in to comment.