Skip to content

Commit

Permalink
Merge pull request #37 from waterskier2007/master
Browse files Browse the repository at this point in the history
fixed issue #36
  • Loading branch information
jakewmeyer committed Jul 27, 2017
2 parents 4d6c6d5 + 6bdcb00 commit 48c2de4
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions app.rb
Expand Up @@ -256,12 +256,7 @@ class SpacexAPI < Sinatra::Base
cap = params['cap']
collection = client[:launch]
hash = collection.find({cap_serial: "#{cap}"}, projection: {_id: 0}).sort({capsule_serial: 1})
array = hash.to_a
if array.empty?
JSON.pretty_generate(error)
else
JSON.pretty_generate(array)
end
JSON.pretty_generate(hash.to_a[0])
end

# Get all Dragon core information
Expand All @@ -283,12 +278,7 @@ class SpacexAPI < Sinatra::Base
core = params['core']
collection = client[:core]
hash = collection.find({core_serial: "#{core}"}, projection: {_id: 0}).sort({core_serial: 1})
array = hash.to_a
if array.empty?
JSON.pretty_generate(error)
else
JSON.pretty_generate(array)
end
JSON.pretty_generate(hash.to_a[0])
end
end
end

0 comments on commit 48c2de4

Please sign in to comment.