Skip to content

Commit

Permalink
fix sort token part
Browse files Browse the repository at this point in the history
  • Loading branch information
maksym committed Dec 8, 2016
1 parent 58900c8 commit 8d43c5b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/fhir/search_token.litcoffee
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ PostgreSQL implementation is based on arrays support - http://www.postgresql.org
exports.fhir_sort_as_token = (plv8, resource, metas)->
value = extract_value(resource, metas)
return null unless value
data = value[0]
data = value.value[0]
if value.elementType == 'boolean'
if data.toString() == 'false' then 'false' else 'true'
Expand Down
8 changes: 4 additions & 4 deletions test/fhir/search_token_spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ specs = [
describe "extract_as_token", ->
specs.forEach (spec)->
it JSON.stringify(spec.path), ->
res = search.fhir_extract_as_token_metas({}, resource,
[
metas = [
{path: ['Resource', 'unknownPath'], elementType: spec.elementType},
{path: spec.path, elementType: spec.elementType}
])
]
res = search.fhir_extract_as_token({}, resource, metas)
assert.deepEqual(res, spec.result)
order = search.fhir_sort_as_token({}, resource, spec.path, spec.elementType)
order = search.fhir_sort_as_token({}, resource, metas)
assert.deepEqual(order, spec.order)

0 comments on commit 8d43c5b

Please sign in to comment.