|
|
@ -37,6 +37,8 @@ class EntriesController < ApplicationController |
|
|
@completion_percent_by_typ_art = {} |
|
|
@completion_percent_by_typ_art = {} |
|
|
@progress_chart_data = {} |
|
|
@progress_chart_data = {} |
|
|
|
|
|
|
|
|
|
|
|
@progress_colors = {} |
|
|
|
|
|
|
|
|
User::PRAKTIKUMSTYPEN.product(User::ENTRY_ARTEN).each do |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 |
|
|
total_required = current_user.required_hours_matrix.to_h.dig(typ, art).to_f |
|
|
remaining_minutes = @remaining_minutes_matrix.dig(typ, art).to_i |
|
|
remaining_minutes = @remaining_minutes_matrix.dig(typ, art).to_i |
|
|
@ -50,9 +52,20 @@ class EntriesController < ApplicationController |
|
|
@completion_percent_by_typ_art[[typ, art]] = percent |
|
|
@completion_percent_by_typ_art[[typ, art]] = percent |
|
|
@progress_chart_data["#{typ.capitalize} – #{art}"] = percent |
|
|
@progress_chart_data["#{typ.capitalize} – #{art}"] = percent |
|
|
else |
|
|
else |
|
|
@completion_percent_by_typ_art[[typ, art]] = 0 |
|
|
|
|
|
@progress_chart_data["#{typ.capitalize} – #{art}"] = 0 |
|
|
|
|
|
|
|
|
percent = 0 |
|
|
|
|
|
@completion_percent_by_typ_art[[typ, art]] = percent |
|
|
|
|
|
@progress_chart_data["#{typ.capitalize} – #{art}"] = percent |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
@progress_colors["#{typ.capitalize} – #{art}"] = if percent < 50 |
|
|
|
|
|
'#007bff' # Blau |
|
|
|
|
|
elsif percent < 90 |
|
|
|
|
|
'#28a745' # Grün |
|
|
|
|
|
else |
|
|
|
|
|
'#dc3545' # Rot |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|