From b425a14f39ca829a4e2b5bcac420b2a3e4a7e3c5 Mon Sep 17 00:00:00 2001 From: dinsmol Date: Thu, 19 Aug 2021 09:26:17 +0300 Subject: [PATCH] added activity type --- app/controllers/admin/accounts_controller.rb | 2 +- app/models/account_activity.rb | 3 ++- config/locales/en.yml | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/accounts_controller.rb b/app/controllers/admin/accounts_controller.rb index c3f72371a..5f7616b3e 100644 --- a/app/controllers/admin/accounts_controller.rb +++ b/app/controllers/admin/accounts_controller.rb @@ -30,7 +30,7 @@ module Admin sum: @sum, currency: @account.currency, description: params[:description], - activity_type: AccountActivity::ADD_CREDIT) + activity_type: AccountActivity::UPDATE_CREDIT) if activity.save true diff --git a/app/models/account_activity.rb b/app/models/account_activity.rb index 9df64209a..d59670995 100644 --- a/app/models/account_activity.rb +++ b/app/models/account_activity.rb @@ -8,6 +8,7 @@ class AccountActivity < ApplicationRecord CREATE = 'create' RENEW = 'renew' ADD_CREDIT = 'add_credit' + UPDATE_CREDIT = 'update_credit' after_create :update_balance def update_balance @@ -20,7 +21,7 @@ class AccountActivity < ApplicationRecord class << self def types_for_select - [CREATE, RENEW, ADD_CREDIT].map { |x| [I18n.t(x), x] } + [CREATE, RENEW, ADD_CREDIT, UPDATE_CREDIT].map { |x| [I18n.t(x), x] } end def to_csv diff --git a/config/locales/en.yml b/config/locales/en.yml index 4566d2302..2ef9a5b81 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -603,6 +603,7 @@ en: receipt_date_from: 'Receipt date from' receipt_date_until: 'Receipt date until' add_credit: 'Add credit' + update_credit: 'Update credit' invalid_yaml: 'Invalid YAML' reserved_pw: 'Reserved pw' no_transfers_found: 'No transfers found'