department-of-veterans-affairs / connect_vbms

VBMS SOAP API client
Other
17 stars 9 forks source link

Pagination bug #250

Closed pkarman closed 4 years ago

pkarman commented 4 years ago

connects #249

VBMS efolder may response with fewer actual documents than it reports in its metadata.

E.g. an efolder response claims there are 344 total docs, but returns only 334 of them.

# first page of results returns 334 docs with metadata
{:@filtered_results=>"10", :@next_start_index=>"-1", :@total_result_count=>"344"}
irb(main):042:0> docs.flatten.length
=> 334
irb(main):043:0> total_docs = pagination[:@total_result_count].to_i
=> 344

Previously this gem would respect the @total_result_count as authoritative. Now, it respects the @next_start_index when ultimately deciding to request another page.