diff --git a/app/controllers/callbacks_controller.rb b/app/controllers/callbacks_controller.rb index 024d727f9..cecd25ef2 100644 --- a/app/controllers/callbacks_controller.rb +++ b/app/controllers/callbacks_controller.rb @@ -43,7 +43,7 @@ def check_identity_with_otp(sofia_account, user) if params[:verification_code].blank? # OTP code not present, so request it render(json: { state: 'otp_prompt' }) - elsif sofia_account.authenticate_otp(params[:verification_code]) + elsif sofia_account.authenticate_otp(params[:verification_code], drift: 60) # OTP code correct sign_in(:user, user) render(json: { state: 'logged_in', redirect_url: user.roles.any? ? root_path : user_path(user.id) }) diff --git a/app/controllers/sofia_accounts_controller.rb b/app/controllers/sofia_accounts_controller.rb index 7493d3375..c38ab988d 100644 --- a/app/controllers/sofia_accounts_controller.rb +++ b/app/controllers/sofia_accounts_controller.rb @@ -59,7 +59,7 @@ def enable_otp # rubocop:disable Metrics/AbcSize, Metrics/MethodLength begin flash_message = - if @sofia_account.authenticate_otp(params.require(:verification_code)) + if @sofia_account.authenticate_otp(params.require(:verification_code), drift: 60) if @sofia_account.update(otp_enabled: true) { success: 'Two-factor-authenticatie aangezet!' } else diff --git a/app/controllers/zatladder_controller.rb b/app/controllers/zatladder_controller.rb index 34093dd83..b9c4e3c3d 100644 --- a/app/controllers/zatladder_controller.rb +++ b/app/controllers/zatladder_controller.rb @@ -24,8 +24,9 @@ def current_year end def zatladder_spendings(from, to) - @users_spendings = User.in_amber.calculate_spendings(from:, to:) - zatladder = User.in_amber.select(:id, :name).map do |user| + users = User.in_amber.exists? ? User.in_amber : User.sofia_account + @users_spendings = users.calculate_spendings(from:, to:) + zatladder = users.select(:id, :name).map do |user| { id: user.id, name: user.name, diff --git a/db/migrate/20251212000001_add_order_total_back_to_orders.rb b/db/migrate/20251212000001_add_order_total_back_to_orders.rb new file mode 100644 index 000000000..7fd06747c --- /dev/null +++ b/db/migrate/20251212000001_add_order_total_back_to_orders.rb @@ -0,0 +1,5 @@ +class AddOrderTotalBackToOrders < ActiveRecord::Migration[7.2] + def change + add_column :orders, :order_total, :decimal, precision: 8, scale: 2 unless column_exists?(:orders, :order_total) + end +end diff --git a/db/schema.rb b/db/schema.rb index 55b7e7575..8e64bb1a8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2025_12_09_160709) do +ActiveRecord::Schema[7.2].define(version: 2025_12_12_000001) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql"