Project

General

Profile

Bug #23599

Getting hosts via API with thin=true returns wrong subtotal value

Added by Tomáš Strachota over 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Host creation
Target version:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

When querying about hosts via API and using this=true the API returns wrong subtotal count. This happens when the query matches more records than what is the current per_page setting.

Example:

Search for "*" on 30 hosts in total with per page being 5 will result in:

results: [5 hosts...]
per_page: 5
total: 30
subtotal: 5

In this example the expected result is subtotal being 30.

Additional info:
The issue is caused by calling `pluck` on the original active record relation when thin=true is used.


Related issues

Has duplicate Foreman - Bug #22326: API gives subtotal=0 when per_page=0 and thin=true and search string is usedDuplicate

Associated revisions

Revision d5f2f1de (diff)
Added by Amir Fefer about 1 year ago

Fixes #23599 - fix subtotal value in API call with thin=true

History

#1 Updated by The Foreman Bot about 1 year ago

  • Assignee set to Amir Fefer
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/5713 added

#2 Updated by Amir Fefer about 1 year ago

  • Legacy Backlogs Release (now unused) set to 330

#3 Updated by Amir Fefer about 1 year ago

  • % Done changed from 0 to 100
  • Status changed from Ready For Testing to Closed

#4 Updated by Tomer Brisker about 1 year ago

  • Has duplicate Bug #22326: API gives subtotal=0 when per_page=0 and thin=true and search string is used added

#5 Updated by Tomer Brisker about 1 year ago

  • Bugzilla link set to 1516929

#6 Updated by The Foreman Bot about 1 year ago

  • Pull request https://github.com/theforeman/foreman/pull/5728 added

Also available in: Atom PDF