diff --git a/app/controllers/entries_controller.rb b/app/controllers/entries_controller.rb index 3027df5..9c4d8e1 100644 --- a/app/controllers/entries_controller.rb +++ b/app/controllers/entries_controller.rb @@ -22,10 +22,6 @@ class EntriesController < ApplicationController end end - @completion_percent_by_typ_art = {} - - - # Verbleibende Minuten je Kombination @remaining_minutes_matrix = {} @time_by_typ_art.each do |typ, arts| @@ -38,6 +34,8 @@ class EntriesController < ApplicationController end end + @completion_percent_by_typ_art = {} + User::PRAKTIKUMSTYPEN.product(User::ENTRY_ARTEN).each do |typ, art| total_required = current_user.required_hours_matrix.to_h.dig(typ, art).to_f remaining_minutes = @remaining_minutes_matrix.dig(typ, art).to_i @@ -61,6 +59,8 @@ class EntriesController < ApplicationController @selbsterfahrungskosten_by_year = Entry.total_selbsterfahrungskosten_by_year(current_user) @allekosten_by_year = Entry.total_semesterkosten_by_year(current_user) + + # Voraussichtliches Ende je Kombination basierend auf weekly_target_matrix # @estimated_end_by_typ_art = {} diff --git a/app/models/entry.rb b/app/models/entry.rb index 2210eb4..9245653 100644 --- a/app/models/entry.rb +++ b/app/models/entry.rb @@ -35,7 +35,7 @@ class Entry < ApplicationRecord .order(Arel.sql("DATE_PART('year', date) DESC")) .pluck( Arel.sql("DATE_PART('year', date)::int"), - Arel.sql("SUM(distance_km * 2 * 0.42)") + Arel.sql("SUM(distance_km * 0.42)") ).to_h end diff --git a/app/views/entries/index.html.erb b/app/views/entries/index.html.erb index ef1307e..2787081 100644 --- a/app/views/entries/index.html.erb +++ b/app/views/entries/index.html.erb @@ -42,7 +42,7 @@
-
📊 Gesamtkosten
+
📊 Gesamtkosten (Werbungskosten)
<% @allekosten_by_year.each do |year, sum| %>

<%= year %>: <%= number_to_currency(sum, unit: "€", separator: ",", delimiter: ".", precision: 2) %>