app/services/token_management/grant_eth_stake_currency.rb
# check if the grant was given to address in past 24 hours
#
# * Author: Ankit
# * Date: 24/01/2019
# * Reviewed By:
#
# @return [Result::Base]
#
check if the grant was given to address in past 24 hours
Author: Ankit
Date: 24/01/2019
Reviewed By.
check if the grant was given to address in past 24 hours Author : Ankit Date : 24 / 01 / 2019 Reviewed By .
def check_time_validation
      workflows = CacheManagement::WorkflowByClient.new([@client_id]).fetch
      if workflows[@client_id].present?
        workflows[@client_id].each do |wf|
          if wf.kind == GlobalConstant::Workflow.grant_eth_stake_currency && (wf.status == GlobalConstant::Workflow.completed || wf.status == GlobalConstant::Workflow.in_progress)
            last_updated_at_epoch = wf.updated_at.to_datetime.to_i
            if (current_timestamp - last_updated_at_epoch) < GlobalConstant::Base.grant_timeout
              return error_with_data(
                'a_s_tm_g_3',
                'grant_limit_reached',
                GlobalConstant::ErrorAction.default
              )
            end
          end
        end
      end
      success
    end
def check_time_validation workflows = CacheManagement :: WorkflowByClient . new ( [ @client_id ] ) . fetch if workflows [ @client_id ] . present? workflows [ @client_id ] . each do | wf | if wf . kind == GlobalConstant :: Workflow . grant_eth_stake_currency && ( wf . status == GlobalConstant :: Workflow . completed || wf . status == GlobalConstant :: Workflow . in_progress ) last_updated_at_epoch = wf . updated_at . to_datetime . to_i if ( current_timestamp - last_updated_at_epoch ) < GlobalConstant :: Base . grant_timeout return error_with_data ( 'a_s_tm_g_3' , 'grant_limit_reached' , GlobalConstant :: ErrorAction . default ) end end end end success end
check if the grant was given to address in past 24 hours
 Author: Ankit
 Date: 24/01/2019
 Reviewed By:
check if the grant was given to address in past 24 hours Author : Ankit Date : 24 / 01 / 2019 Reviewed By :
#If the row is updated in last 24 hours then throw error
None
Result::Base