Bug 1507108

Summary: Order count is incorrect
Product: Red Hat CloudForms Management Engine Reporter: Kedar Kulkarni <kkulkarn>
Component: UI - ServiceAssignee: Allen W <awight>
Status: CLOSED CURRENTRELEASE QA Contact: Dave Johnson <dajohnso>
Severity: low Docs Contact:
Priority: low    
Version: 5.9.0CC: apagac, bascar, dclarizi, jhardy, kkulkarn, lavenel, mkanoor, obarenbo, smallamp, sshveta, tfitzger
Target Milestone: GAKeywords: TestOnly
Target Release: 5.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.10.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1510250 (view as bug list) Environment:
Last Closed: 2018-06-21 21:11:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1510250    
Attachments:
Description Flags
Screenshot
none
Service UI - Service Order list none

Description Kedar Kulkarni 2017-10-27 17:40:40 UTC
Created attachment 1344425 [details]
Screenshot

Description of problem:
Please see attached screenshot. There are only 2 orders in the list but on the left side in navigation pane, it is showing count "3".


Version-Release number of selected component (if applicable):
CFME 5.9.0.4

How reproducible:
Believe 100%

Steps to Reproduce:
1.Create some service in OPS UI
2.Login to Service UI and order the service
3.Check number of orders in the orders pane.

Actual results:
count is off by 1

Expected results:
Count should be accurate

Additional info:

Comment 2 Chris Kacerguis 2017-10-27 17:42:34 UTC
Could you please provide an appliance for us to look at?

Comment 4 Chris Kacerguis 2017-10-27 18:11:25 UTC
Thanks.

Looking that this, the API is saying there are 3 orders, check here:

https://10.8.197.199/api/service_orders

Digging around, there are 3 orders:

https://10.8.197.199/ui/service/orders/1
https://10.8.197.199/ui/service/orders/2
https://10.8.197.199/ui/service/orders/3

Now, 3 doesn't show up, but I can access it.  But, something looks odd with that order (there is nothing there).  This *seems* to be a bug, BUT it's not with the SUI; we just display the info that the API returns...and the API is telling us there are 3 orders.

Going to send this to Greg M for him to take a look.

Comment 8 Sudhir Mallamprabhakara 2017-11-02 14:49:16 UTC
*** Bug 1508112 has been marked as a duplicate of this bug. ***

Comment 9 Chris Kacerguis 2017-11-03 13:01:11 UTC
*** Bug 1509226 has been marked as a duplicate of this bug. ***

Comment 11 Greg McCullough 2017-11-03 15:09:51 UTC
My understanding is the Service UI creates a cart for the user on startup.  That would be 1 cart per user/tenant.  If multiple users or and user switches to a new tenant they would get a new cart created and the old cart would still be available in the db.

Could this account for it?

Do you have an appliance I can connect to and review the current state?

My understand is that this is not causing any issues, correct?

Comment 13 Greg McCullough 2017-11-03 16:47:56 UTC
Created attachment 1347438 [details]
Service UI - Service Order list

Clarified with Kedar that the issue is the Service UI count is including all Service Order instances regardless of the state of the order.

In the attached screenshot you can see that 3 service_order instances exist in the database with a state of "ordered" and one is in the state "cart" which represents the current Service UI cart object.  The count next to "My Orders" list 4 but only includes the 3 "Ordered" instances.

My guess is the ServiceUI should be excluding the current "cart" service_order from this count.

Sending to Service UI to review.

Comment 14 Allen W 2017-11-06 21:15:57 UTC
Ok chewing on this, feels familiar, shouldn't be long to fix. ⚔️

Comment 15 Allen W 2017-11-06 22:00:38 UTC
@Kedar, thanks for noticing this, looks like we were not correctly building the query to include the filter "status=ordered" so yaaaaah you were seeing that mystery cart item, check the pr for the fix! 

https://github.com/ManageIQ/manageiq-ui-service/pull/1220