diff --git a/Dockerfile b/Dockerfile index 46505c7..bd0f1b3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -62,6 +62,9 @@ USER rails:rails # Entrypoint prepares the database. ENTRYPOINT ["/rails/bin/docker-entrypoint"] +HEALTHCHECK --interval=5m --timeout=3s \ + CMD curl -f http://localhost:3000 || exit 1 + # Start the server by default, this can be overwritten at runtime -EXPOSE 3000 -CMD ["./bin/rails", "server"] +#EXPOSE 3000 +#CMD ["./bin/rails", "server"] diff --git a/app/controllers/entries_controller.rb b/app/controllers/entries_controller.rb index 6625cc7..d584962 100644 --- a/app/controllers/entries_controller.rb +++ b/app/controllers/entries_controller.rb @@ -36,6 +36,9 @@ class EntriesController < ApplicationController entries.sum(&:kilometer_pauschale) end + @fortbildungskosten_by_year = Entry.total_fortbildungskosten_by_year(current_user) + + # Voraussichtliches Ende je Kombination basierend auf weekly_target_matrix @estimated_end_by_typ_art = {} @remaining_minutes_matrix.each do |typ, arts| @@ -106,7 +109,9 @@ class EntriesController < ApplicationController :minutes, :praktikums_typ, :entry_art, - :distance_km + :distance_km, + :beschreibung, + :kosten ) end diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb new file mode 100644 index 0000000..d6bad98 --- /dev/null +++ b/app/controllers/static_pages_controller.rb @@ -0,0 +1,4 @@ +class StaticPagesController < ApplicationController + def impressum + end +end diff --git a/app/models/entry.rb b/app/models/entry.rb index 25798af..f8bfb6c 100644 --- a/app/models/entry.rb +++ b/app/models/entry.rb @@ -12,7 +12,7 @@ class Entry < ApplicationRecord before_save :normalize_time PRAKTIKUMSTYPEN = %w[propädeutikum fachspezifikum] - ENTRY_ARTEN = %w[Praktikum Selbsterfahrung Supervision] + ENTRY_ARTEN = %w[Praktikum Selbsterfahrung Supervision Fortbildung] validates :praktikums_typ, inclusion: { in: PRAKTIKUMSTYPEN } validates :entry_art, inclusion: { in: ENTRY_ARTEN } @@ -23,6 +23,12 @@ class Entry < ApplicationRecord distance_km * 0.42 end + def self.total_fortbildungskosten_by_year(user) + where(user: user, entry_art: 'Fortbildung') + .group_by { |e| e.date.year } + .transform_values { |entries| entries.sum { |e| e.kosten.to_f } } + end + def jahr date.year end @@ -42,6 +48,8 @@ class Entry < ApplicationRecord entry.praktikums_typ, entry.entry_art, entry.distance_km, + entry.beschreibung, + entry.kosten, entry.user.email ] end diff --git a/app/views/entries/_form.html.erb b/app/views/entries/_form.html.erb index 7c71b10..3bbcf4a 100644 --- a/app/views/entries/_form.html.erb +++ b/app/views/entries/_form.html.erb @@ -11,7 +11,7 @@ <% end %> -
<%= year %>: <%= number_to_currency(sum, unit: "€", separator: ",", delimiter: ".", precision: 2) %>
+ <% end %> + +Gesamtzeit: <%= @total_minutes / 60 %> h <%= @total_minutes % 60 %> min