|
|
|
@ -8,6 +8,10 @@ class EntriesController < ApplicationController |
|
|
|
# Gesamtzeit in Minuten |
|
|
|
@total_minutes = @entries.sum { |e| e.hours.to_i * 60 + e.minutes.to_i } |
|
|
|
|
|
|
|
@total_minutes_praktikum_prop = @entries.where(praktikums_typ: Entry::PRAKTIKUMSTYPEN[0], entry_art: Entry::ENTRY_ARTEN[0]).sum { |e| e.hours.to_i * 60 + e.minutes.to_i } |
|
|
|
|
|
|
|
@total_minutes_praktikum_fach = @entries.where(praktikums_typ: Entry::PRAKTIKUMSTYPEN[1], entry_art: Entry::ENTRY_ARTEN[0]).sum { |e| e.hours.to_i * 60 + e.minutes.to_i } |
|
|
|
|
|
|
|
# Gesamtbetrag der Kilometerpauschale |
|
|
|
@total_kilometer_pauschale = @entries.sum(&:kilometer_pauschale) |
|
|
|
|
|
|
|
@ -36,7 +40,6 @@ 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 = {} |
|
|
|
@ -65,7 +68,7 @@ class EntriesController < ApplicationController |
|
|
|
typ = params[:typ] |
|
|
|
art = params[:art] |
|
|
|
|
|
|
|
@entry = current_user.entries.create!(start_time: Time.current, beschreibung: "Timer" , praktikums_typ:typ, entry_art: art) |
|
|
|
@entry = current_user.entries.create!(start_time: Time.current, beschreibung: "Timer", praktikums_typ: typ, entry_art: art) |
|
|
|
redirect_to entries_path, notice: "Timer gestartet" |
|
|
|
end |
|
|
|
|
|
|
|
@ -76,8 +79,6 @@ class EntriesController < ApplicationController |
|
|
|
@entry.end_time = Time.current |
|
|
|
@entry.lunch_break_minutes = 30 if ActiveModel::Type::Boolean.new.cast(params[:lunch_break]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
total_minutes = @entry.total_minutes_including_break |
|
|
|
@entry.hours = total_minutes / 60 |
|
|
|
@entry.minutes = total_minutes % 60 |
|
|
|
@ -159,6 +160,7 @@ class EntriesController < ApplicationController |
|
|
|
} |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
private |
|
|
|
|
|
|
|
def set_entry |
|
|
|
|