From d0ba2c091c52c674aaee92429156f2b4c62c6a41 Mon Sep 17 00:00:00 2001 From: Christoph Marzell Date: Thu, 13 Nov 2025 12:50:44 +0100 Subject: [PATCH] add minus break --- app/controllers/entries_controller.rb | 4 +++- app/views/entries/index.html.erb | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/controllers/entries_controller.rb b/app/controllers/entries_controller.rb index 56b928e..38043a6 100644 --- a/app/controllers/entries_controller.rb +++ b/app/controllers/entries_controller.rb @@ -74,7 +74,9 @@ class EntriesController < ApplicationController #@entry = current_user.entries.where(end_time: nil).order(start_time: :desc).first if @entry @entry.end_time = Time.current - @entry.lunch_break_minutes = params[:lunch_break_minutes].to_i + @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 diff --git a/app/views/entries/index.html.erb b/app/views/entries/index.html.erb index 0d841d7..a62238f 100644 --- a/app/views/entries/index.html.erb +++ b/app/views/entries/index.html.erb @@ -111,7 +111,13 @@ Dauer: Berechne …
- <%= button_to '⏹️ Stoppen', stop_timer_entry_path(@running_entry), method: :post, class: "btn btn-danger" %> + <%= form_with url: stop_timer_entry_path(@running_entry), method: :post, local: true do |f| %> +
+ <%= f.check_box :lunch_break, class: 'form-check-input', id: 'lunch_break' %> + <%= f.label :lunch_break, '30 Min Mittagspause abziehen', class: 'form-check-label' %> +
+ <%= f.submit '⏹️ Stoppen', class: "btn btn-danger" %> + <% end %>
<% end %>