From fa77a691ce0cc8941fe470a762f352b27f4f0563 Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Sun, 23 Nov 2025 17:54:45 +0100 Subject: Last commit. --- .../_nutrient_measurements_table.html.erb | 4 +-- .../dashboard/_nutrient_target_table.html.erb | 35 ++++++++----------- app/views/dashboard/_raft_allocation.html.erb | 9 ----- app/views/dashboard/_target_table.html.erb | 39 ---------------------- app/views/dashboard/index.html.erb | 4 --- 5 files changed, 16 insertions(+), 75 deletions(-) delete mode 100644 app/views/dashboard/_raft_allocation.html.erb delete mode 100644 app/views/dashboard/_target_table.html.erb (limited to 'app/views/dashboard') diff --git a/app/views/dashboard/_nutrient_measurements_table.html.erb b/app/views/dashboard/_nutrient_measurements_table.html.erb index 82ea6ff..4d516bd 100644 --- a/app/views/dashboard/_nutrient_measurements_table.html.erb +++ b/app/views/dashboard/_nutrient_measurements_table.html.erb @@ -2,8 +2,8 @@

Relevé des Nutriments

- <%= link_to "Ajouter un relevé", new_nutrient_measurement_path, class: "btn btn-sm btn-primary" %> - <%= link_to "Liste des relevés", nutrient_measurements_path, class: "btn btn-sm btn-secondary" %> + <%= link_to "Ajouter un relevé", new_nutrient_measurement_path, class: "btn btn-sm btn-outline-primary" %> + <%= link_to "Liste des relevés", nutrient_measurements_path, class: "btn btn-sm btn-outline-secondary" %>
diff --git a/app/views/dashboard/_nutrient_target_table.html.erb b/app/views/dashboard/_nutrient_target_table.html.erb index 7cf294c..006d262 100644 --- a/app/views/dashboard/_nutrient_target_table.html.erb +++ b/app/views/dashboard/_nutrient_target_table.html.erb @@ -2,40 +2,33 @@

Complémentation

- <%= link_to "Nouvelle cible", new_target_path, class: "btn btn-sm btn-primary" %> - <%= link_to "Voir la recette", root_path, class: "btn btn-sm btn-secondary" %> + <%= link_to "Nouvelle cible", new_target_path, class: "btn btn-sm btn-outline-primary" %> + <%= link_to "Liste des cibles", targets_path, class: "btn btn-sm btn-outline-secondary" %> + <%= link_to "Voir la recette", root_path, class: "btn btn-sm btn-outline-secondary" %>
- +
- - + + - <% wr = @weighted || {} %> - <% lm = @latest_measurements || {} %> + <% Nutrient.all.each do |nutrient| %> + <% measured = @latest_measurement.send(nutrient.formula.downcase) %> + <% target = @latest_target.send(nutrient.formula.downcase) %> + <% delta = (target.to_f - measured.to_f) / 100.0 if measured || target %> - <% keys = (wr.keys + lm.keys).map(&:to_s).uniq.sort %> - <% keys.each do |nut| %> - <% measured = lm[nut] %> - <% target = wr[nut] %> - <% delta = (measured.to_f - target.to_f) if measured || target %> - - +
Nutriment RelevéCibleDelta<%= @latest_target&.name || "Cible" %>Delta (%)
<%= nut.upcase %><%= nutrient.formula %> - <% if measured.nil? %> - - <% else %> - <%= number_with_precision(measured, precision: 2) %> - <% end %> + <%= measured.present? ? number_with_precision(measured, precision: 2) : — %> @@ -50,7 +43,7 @@ <% if measured.nil? && target.nil? %> <% else %> - <% badge = + <% badge_class = if delta.nil? "text-bg-secondary" elsif delta.abs <= 0.01 @@ -60,7 +53,7 @@ else "text-bg-danger" end %> - + <%= number_with_precision(delta.to_f, precision: 2) %> <% end %> diff --git a/app/views/dashboard/_raft_allocation.html.erb b/app/views/dashboard/_raft_allocation.html.erb deleted file mode 100644 index 1c9ef9a..0000000 --- a/app/views/dashboard/_raft_allocation.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -
-
-
Crop Allocation
- <%#= link_to "Edit allocation", beds_path, class: "btn btn-sm btn-primary" %> -
- - <%= bar_chart @raft_data, stacked: true %> -
- diff --git a/app/views/dashboard/_target_table.html.erb b/app/views/dashboard/_target_table.html.erb deleted file mode 100644 index b1553dc..0000000 --- a/app/views/dashboard/_target_table.html.erb +++ /dev/null @@ -1,39 +0,0 @@ -
-
-
Target nutrient concentrations
- <%= link_to "Get Ferti© recipe", ferti_recipe_path, class: "btn btn-sm btn-primary" %> -
- -
- - - - - - - - - - - <% NutrientsHelper::NUTRIENTS.each do |n| %> - <% latest = @latest_measurement[n] || 0 %> - <% target = @target[n] || 0 %> - <% delta = target - latest %> - - - - - - - <% end %> - -
Nutrient Latest (mg/L)Target (mg/L)Δ %
<%= n.upcase %><%= fmt(latest) %><%= fmt(target) %> - - <%= fmt(delta) %>% - -
-
- -
diff --git a/app/views/dashboard/index.html.erb b/app/views/dashboard/index.html.erb index a954e4c..50fab18 100644 --- a/app/views/dashboard/index.html.erb +++ b/app/views/dashboard/index.html.erb @@ -2,8 +2,4 @@ <%= render "nutrient_target_table", nutrient_profiles: @nutrient_profiles %> -<%#= render "raft_allocation" %> - -<%#= render "target_table" %> - <%= render "nutrient_measurements_table" %> -- cgit v1.2.3