-
Notifications
You must be signed in to change notification settings - Fork 160
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
List of interventions doesn't appear in backend/activity_productions#show view #528
Comments
The problem seems to be link with heritage in Rails. For example, the scope :of_generic_role in InterventionParameter scope :of_generic_role, lambda { |role|
role = role.to_s
unless %w(doer input output target tool).include?(role)
raise ArgumentError, "Invalid role: #{role}"
end
where(type: "Intervention#{role.camelize}")
} produce SELECT "interventions".* FROM "interventions"
WHERE "interventions"."id"
IN (SELECT "intervention_parameters"."intervention_id" FROM "intervention_parameters"
WHERE "intervention_parameters"."type"
IN ('InterventionProductParameter') AND "intervention_parameters"."type" = 'InterventionOutput' AND "intervention_parameters"."product_id" = 586)
ORDER BY "interventions"."id"
ASC LIMIT 1 the problem is link to WHERE "intervention_parameters"."type" |
From what line did you call After some tests, I can't reproduce your SQL query:
Or:
Or:
|
The last one. [7] pry(main)> i = Intervention.with_generic_cast(:output, p)
Intervention Load (0.4ms) SELECT "interventions".* FROM "interventions" WHERE "interventions"."id" IN (SELECT "intervention_parameters"."intervention_id" FROM "intervention_parameters" WHERE "intervention_parameters"."type" IN ('InterventionProductParameter') AND "intervention_parameters"."type" = $1 AND "intervention_parameters"."product_id" = $2) [["type", "InterventionOutput"], ["product_id", 537]]
=> [] |
On my side, I got that:
|
Maybe you have a example in the app, in the terminal if you load wanted models you'll have what you want. |
I agree it works if models are loaded. |
The issue still exists in v 2.0.0. rc23 |
The issue still exists in v.2.0.0rc24. |
It occurs when you start the server and you call a product show page. The associated interventions don't appear because of malformed sql. This is due to STI of InterventionProductParameter model. To manually force inheritance, you need to go to the interventions page and come back to product show page. |
Sorry but it is not working with v2.0.0rc24 on SaaS. :( |
I'm investigation. It works on some production: https://demo.ekylibre.farm/backend/activity_productions/51 |
Does it take only intervention made in 2016 as there is no year selector ?? |
I try to create 2 interventions today (to be in 2016 then) one targeting the crop and the other targeting the parcel. None of them show up in Intervention list. |
No filters on campaign (https://github.com/ekylibre/ekylibre/blob/2.0.0.rc25/app/controllers/backend/activity_productions_controller.rb#L34). |
OK. Working then. Can you explain what it is not automatic ? May I warn you: with many intervention, it is hard to read. Will probably be better with the jalons or with consolidating intervention by type (= one graph entry for all fertilization). (My price a not all set so human work can seems to be really "cheap"). Anyway: thank you ! |
It's not automatic for now, but it will be. As long as, interventions cannot set these distributions automatically, we'll need the user to do that distribution manually |
The pre-selection look good I had just to validate it. I will check consistency but it looks fine. |
The list of interventions link to one production doesn't appear in the production view.
![interventions_list](https://cloud.githubusercontent.com/assets/11627573/14169823/4bb40efc-f72a-11e5-81b7-2f885a78c6e0.jpg)
The text was updated successfully, but these errors were encountered: