Browse Source

add erledigt

main
Christoph Marzell 1 month ago
parent
commit
159f8c30d7
  1. 13
      app/controllers/entries_controller.rb
  2. 3
      app/views/entries/index.html.erb

13
app/controllers/entries_controller.rb

@ -24,13 +24,15 @@ class EntriesController < ApplicationController
# Verbleibende Minuten je Kombination
@remaining_minutes_matrix = {}
@spent_minutes_matrix = {}
@time_by_typ_art.each do |typ, arts|
@remaining_minutes_matrix[typ] ||= {}
@spent_minutes_matrix[typ] ||= {}
arts.each do |art, spent_minutes|
target = current_user.required_hours_matrix.dig(typ, art).to_i * 60
remaining = [target - spent_minutes, 0].max
@remaining_minutes_matrix[typ][art] = remaining
@spent_minutes_matrix[typ][art] = spent_minutes
end
end
@ -64,23 +66,14 @@ class EntriesController < ApplicationController
else
'#dc3545' # Rot
end
end
@total_kilometer_costs_by_year = Entry.total_kilometer_cost_by_year(current_user)
@fortbildungskosten_by_year = Entry.total_fortbildungskosten_by_year(current_user)
@selbstsupervision_by_year = Entry.total_supervision_by_year(current_user)
@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 = {}

3
app/views/entries/index.html.erb

@ -26,6 +26,7 @@
<th>Typ</th>
<th>Art</th>
<th>Verbleibend</th>
<th>Erledigt</th>
<th>Soll (h)</th>
<th>Wöchentlich</th>
<th>Vorauss. Ende</th>
@ -36,6 +37,7 @@
<% ["propädeutikum", "fachspezifikum"].each do |typ| %>
<% ["Praktikum", "Selbsterfahrung", "Supervision"].each do |art| %>
<% remaining = @remaining_minutes_matrix.dig(typ, art) %>
<% spent = @spent_minutes_matrix.dig(typ, art) %>
<% soll = current_user.required_hours_matrix.dig(typ, art) %>
<% weekly = current_user.weekly_target_matrix.dig(typ, art) %>
<% ende = @estimated_end_by_typ_art.dig(typ, art) %>
@ -45,6 +47,7 @@
<td><%= typ.capitalize %></td>
<td><%= art.capitalize %></td>
<td><%= remaining ? "#{remaining / 60} h #{remaining % 60} min" : "—" %></td>
<td><%= spent ? "#{spent / 60} h #{spent % 60} min" : "—" %></td>
<td><%= soll || "—" %> h</td>
<td><%= weekly || "—" %> h/Woche</td>
<td><%= ende.present? ? ende.strftime("%d.%m.%Y") : "—" %></td>

Loading…
Cancel
Save