OBPIH-6993 fix. Wrap text within select2 options and fix product avai…#5565
OBPIH-6993 fix. Wrap text within select2 options and fix product avai…#5565alannadolny merged 1 commit intodevelopfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #5565 +/- ##
============================================
- Coverage 9.12% 8.52% -0.61%
+ Complexity 1170 1113 -57
============================================
Files 701 703 +2
Lines 45281 45343 +62
Branches 10851 10868 +17
============================================
- Hits 4131 3864 -267
- Misses 40497 40905 +408
+ Partials 653 574 -79 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| } | ||
|
|
||
| var \$state = \$( | ||
| "<span><span></span></span>" |
There was a problem hiding this comment.
fix 2: This formatSelectedOptions is what allows the selected products to text wrap
I don't know why it needs two spans to work 🤷. This is how it works in their example: https://select2.org/selections#templating. I tried playing around with it and couldn't get it to work otherwise
| minimumInputLength: "${minSearchValueLength ?: "3"}", | ||
| width: "100%", | ||
| allowClear: true, | ||
| allowClear: false, |
There was a problem hiding this comment.
fix 1: this is what removes the 'X' that clears the whole element
| WHERE | ||
| pa.location = :location | ||
| ${quantityCondition} | ||
| ${productsIds ? "AND pa.product.id IN (:products)" : ""} |
There was a problem hiding this comment.
fix 3: this is what fixes the broken query. On the reporting tab it's not required to pass in products so we only want to filter by them if given a non-empty list
Note: the reason I didn't catch this error initially is because it only happens when you set the end date == today. This is because this flow is only entered when fetching the current QoH, which allows us to rely on product availability. When end date < today, we need to calculate QoH at the time manually, and so don't query product availability
| return args.findAll { paramName, paramValue -> | ||
| sql.contains("${PARAM_IDENTIFIER}${paramName}") | ||
| } | ||
| } |
There was a problem hiding this comment.
Hurray Evan has an over the top solution again!
We're now only conditionally including a where product_id in (:products) clause to the SQL query (it is excluded if products is empty), and so need to only include a value for the :products param if the "where" is in the SQL.
Instead of adding an if (products) check when generating the list of params, I decided to create this util which will do it for us. That way we can always pass in all the params, and this util will filter out the ones that should be excluded.
…lability query
✨ Description of Change
Link to GitHub issue or Jira ticket: https://pihemr.atlassian.net/browse/OBPIH-6993
Description: Three changes:
📷 Screenshots & Recordings (optional)