-
Notifications
You must be signed in to change notification settings - Fork 1
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
Get current_orders plugin working #6
Comments
I enabled it in Foodsoft, build it locally with tag
|
Fixing one error and a warning, but when clicking a new article, it seems like a new group_order_article is added with an empty ordergroup (returning HTTP 500). diff --git a/plugins/current_orders/app/controllers/current_orders/articles_controller.rb b/plugins/current_orders/app/controllers/current_orders/articles_controller.rb
index 4f33f98e..503c4633 100644
--- a/plugins/current_orders/app/controllers/current_orders/articles_controller.rb
+++ b/plugins/current_orders/app/controllers/current_orders/articles_controller.rb
@@ -34,7 +34,7 @@ class CurrentOrders::ArticlesController < ApplicationController
else
@order_articles = OrderArticle.where(order_id: @current_orders.all.map(&:id))
end
- @q = OrderArticle.search(params[:q])
+ @q = OrderArticle.ransack(params[:q])
@order_articles = @order_articles.ordered.merge(@q.result).includes(:article, :article_price)
@order_article = @order_articles.where(id: params[:id]).first
end
diff --git a/plugins/current_orders/app/views/current_orders/articles/_article.html.haml b/plugins/current_orders/app/views/current_orders/articles/_article.html.haml
index 15d7f9d3..b6838544 100644
--- a/plugins/current_orders/app/views/current_orders/articles/_article.html.haml
+++ b/plugins/current_orders/app/views/current_orders/articles/_article.html.haml
@@ -8,6 +8,6 @@
%h2= t('current_orders.articles.index.title')
#articles_by_articles
%p
- %i= t '.counts', ordergroups: Ordergroup.joins(:orders).where(orders: {state: 'finished'}).count(distinct: true), articles: @order_articles.count
+ %i= t '.counts', ordergroups: Ordergroup.joins(:orders).where(orders: {state: 'finished'}).distinct.count, articles: @order_articles.count
%p
%i= t '.no_selection' |
So ideally we'd integrate current_orders functionality in Foodsoft. |
Since foodcoops/foodsoft#373 we have this plugin upstream. But it is likely that it is broken, so can be fixed upstream. Maybe for a while, we can have our own version of the current_orders plugin. Then when it is working for us, we can see what we can bring upstream (which would be good to fix as well, of course). |
A suggestion for the piece / weight switch (foodcoop-adam/foodsoft#187) would be to do this client-side in Javascript, e.g. with a Stimulus controller. |
The current_orders plugin has a member checkout screen, which is heavily used in the foodcoop.
First the plugin needs to be enabled, then we need to make sure it still works fine.
Changes can also be sent upstream as a PR.
Note that the newer version of Foodsoft has support for a pickup day, and may have a screen already to work with the current pickup day. It would make sense to integrate the current_orders plugin functionality there, perhaps. But let's first get it working again (and perhaps it still works, just need to check it does).
The text was updated successfully, but these errors were encountered: