Skip to content

Commit

Permalink
[Automated] Merged master into target k8s
Browse files Browse the repository at this point in the history
  • Loading branch information
va-vsp-bot authored Apr 5, 2024
2 parents 8602644 + 36f4cf4 commit 7089542
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion lib/rx/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ def post_refill_rxs(ids)
#
def post_refill_rx(id)
if (result = perform(:post, "prescription/rxrefill/#{id}", nil, token_headers))
Common::Collection.bust([cache_key('getactiverx'), cache_key('gethistoryrx')])
keys = [cache_key('getactiverx'), cache_key('gethistoryrx')].compact
Common::Collection.bust(keys) unless keys.empty?
end
result
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,16 @@ def refill

def refill_prescriptions
ids = params[:ids]
begin
ids.each do |id|
client.post_refill_rx(id)
end
successful_ids = []
failed_ids = []
ids.each do |id|
client.post_refill_rx(id)
successful_ids << id
rescue => e
puts "Error refilling prescription: #{e.message}"
puts "Error refilling prescription with ID #{id}: #{e.message}"
failed_ids << id
end
head :no_content
render json: { successful_ids:, failed_ids: }
end

def list_refillable_prescriptions
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/rx/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
if caching_enabled
expect(Common::Collection).to receive(:bust).with(cache_keys)
else
expect(Common::Collection).to receive(:bust).with([nil, nil])
expect(Common::Collection).not_to receive(:bust).with([nil, nil])
end

client_response = client.post_refill_rx(13_650_545)
Expand Down

0 comments on commit 7089542

Please sign in to comment.