Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Products can't be added to Outgoing O/C (Aus Customer) #5773

Closed
emilyjeanrogers opened this issue Jul 16, 2020 · 6 comments · Fixed by #5775
Closed

Products can't be added to Outgoing O/C (Aus Customer) #5773

emilyjeanrogers opened this issue Jul 16, 2020 · 6 comments · Fixed by #5775
Assignees
Labels
bug-s2 The bug is affecting any of the non-critical features described in S1 and there is no workaround.

Comments

@emilyjeanrogers
Copy link

Description

Products can't be added to Order Cycle. When customer clicks on expand arrow to view Products in Outgoing Products tab of Order Cycle, this message appears:

Loading..

Expanded product list never loads. Products cannot be added to Order Cycle.

Expected Behavior

List of Products available to add to Outgoing should appear.

Actual Behaviour

Customer sees message:

Loading..

When logged in as Superadmin and viewing this Order Cycle, this error appears:

[missing %{num_of_variants_loaded} value] of 428 Variants Loaded

Steps to Reproduce

  1. Go to any Order Cycle for Baw Baw Food Hub (current order cycle closes 19 July 2020)
  2. Go to Outgoing Tab
  3. Click on Expand arrow in Products
  4. Error (when logged in as Superadmin)
  5. Loading... (when logged in as Manager of Enterprise)

Animated Gif/Screenshot

Screen Shot 2020-07-16 at 11 23 56 AM

Screen Shot 2020-07-16 at 11 36 18 AM

Workaround

No workaround. Can't add products to Order Cycle (Order Cycle is currently open, but new products need to be added)

Severity

Your Environment

Possible Fix

@emilyjeanrogers emilyjeanrogers added the bug-s2 The bug is affecting any of the non-critical features described in S1 and there is no workaround. label Jul 16, 2020
@mkllnk mkllnk assigned mkllnk and unassigned mkllnk Jul 16, 2020
@luisramos0
Copy link
Contributor

Maybe time to activate bugsnag JS on the backoffice...
If we had that, we would see the JS error on the user browser.

@emilyjeanrogers if you are doing user support and can replicate errors, it's useful if you can provide the data available in the browser dev tools. I managed to reproduce in this case and I can see this:
image

It's usually on the console tab or the network tab (like in this case) and then on the network tab, on the line with a non-green color.

Anyway, now we need to find out why this syntax error is poping up for this hub.

@luisramos0
Copy link
Contributor

luisramos0 commented Jul 16, 2020

I can confirm this is a v3regression.

Something changed about the SQL that is generated here:

def products_for_outgoing_exchange
supplied_products(enterprises_for_outgoing_exchange.select(:id)).
includes(:variants).
where("spree_variants.id": incoming_exchanges_variants)
end

The problem only occurs if filter_visible is used in the supplied_products method.

I tried changing the OC settings to not filter on "coordinator only" and found that it's not working in v3 🙈
image

This would have been the quick workaround for this issue because this bug only happens if the "coordinator inventory only" filter is selected. So, this is issue only happens if the option on the left is selected.

This bug in the form (cant change the OC config) is very easy to fix but maybe even before a PR is created, as a quick workaround, we can change the value directly in the database so that the Hub can operate immediately?

@luisramos0
Copy link
Contributor

This is also fairly easy to replicate with sample data. Just activate the OC setting "coordinator inventory only" and go to outgoing exchanges, it breaks for me with sample data (added Fred's Garlic to Fredo's Inventory and tried to sell it in an OC with the filter on).

@RachL
Copy link
Contributor

RachL commented Jul 16, 2020

@luisramos0 do we have automated tests for this? Or can they be added as part of the fix? I must admit that on my side I never test this option during release testing :(

@luisramos0
Copy link
Contributor

Yeah, I have the code fix done in #5775 I need to write some tests now.

@luisramos0
Copy link
Contributor

The PR is ready for review now.
@RachL we now have 2 simple auto tests that make sure:

  1. no products are shown if this option is active and the coordinator's inventory is empty
    2 that only a specific variant added to the coordinator's inventory will show in the exchanges if the option is active

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-s2 The bug is affecting any of the non-critical features described in S1 and there is no workaround.
Projects
None yet
4 participants