What used to be done as ```sql SELECT "order_cycles".* FROM "order_cycles" WHERE (order_cycles.orders_open_at <= '2019-07-29 17:45:20.137294' AND order_cycles.orders_close_at >= '2019-07-29 17:45:20.137333') SELECT DISTINCT "enterprises".* FROM "enterprises" INNER JOIN "exchanges" ON "enterprises"."id" = "exchanges"."receiver_id" WHERE "exchanges"."order_cycle_id" = 1 AND "exchanges"."incoming" = 'f' (...) SELECT DISTINCT "enterprises".* FROM "enterprises" INNER JOIN "exchanges" ON "enterprises"."id" = "exchanges"."receiver_id" WHERE "exchanges"."order_cycle_id" = 4 AND "exchanges"."incoming" = 'f' ``` it became ```sql SELECT "order_cycles".* FROM "order_cycles" WHERE (order_cycles.orders_open_at <= '2019-07-29 17:45:20.137294' AND order_cycles.orders_close_at >= '2019-07-29 17:45:20.137333') SELECT "exchanges".* FROM "exchanges" WHERE "exchanges"."incoming" = 'f' AND "exchanges"."order_cycle_id" IN (1, 2, 3, 4) SELECT "enterprises".* FROM "enterprises" WHERE "enterprises"."id" IN (3, 4, 5, 6) ``` I haven't got any perf numbers yet but each of the N+1 queries took as long as the single `enterprises` query on my dev machine. This should have a noticeable perf impact since the changed method belongs to the `BaseController` seems to be executed in all HTML requests as it gets called by ```ruby before_filter :warn_invalid_order_cycles, if: :html_request? ```
Open Food Network
The Open Food Network is an online marketplace for local food. It enables a network of independent online food stores that connect farmers and food hubs (including coops, online farmers' markets, independent food businesses etc); with individuals and local businesses. It gives farmers and food hubs an easier and fairer way to distribute their food.
Supported by the Open Food Foundation and a network of global affiliates, we are proudly open source and not-for-profit - we're trying to seriously disrupt the concentration of power in global agri-food systems, and we need as many smart people working together on this as possible.
We're part of global movement - get involved!
- Join the conversation on Slack. Make sure you introduce yourself in the #general channel
- Head to https://openfoodnetwork.org for more information about the global OFN project.
- Check out the User Guide for a list of features and tutorials.
- Join our discussion forum.
Contributing
If you are interested in contributing to the OFN in any capacity, please introducing yourself on Slack, and have a look through our Contributor Guide
Our GETTING_STARTED and CONTRIBUTING guides are the best place to start for developers looking to set up a development environment and make contributions to the codebase.
Provisioning
If you're interested in provisioning a server, see ofn-install for the project's Ansible playbooks.
We also have a Super Admin Guide to help with configuration of new servers.
Testing
We use BrowserStack as a manual testing tool. BrowserStack provides open source projects with unlimited and free of charge accounts. A big thanks to them!
Licence
Copyright (c) 2012 - 2019 Open Food Foundation, released under the AGPL licence.
