Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CashRebate.where(state:["complete","forfeit","granted"], granted_at:nil).select{ |cr| cr.created_at == cr.updated_at }.each do |cr|
- cr.granted_at = cr.created_at
- cr.save
- end
- CashRebate.where(state:["complete","forfeit","granted"], granted_at:nil, rebate_type:"Settlement").each do |cr|
- cr.update!(granted_at: cr.created_at)
- end
- CashRebate.where(state:["complete","forfeit","granted"], granted_at:nil).last
- CashRebate.where(state:["complete","forfeit","granted"], granted_at:nil, rebate_type:"").where.not(installment_month:nil).count
- CashRebate.where(state:["complete","forfeit","granted"], granted_at:nil, rebate_type:"").where.not(installment_month:nil).first
- CashRebate.where(state:["complete","forfeit","granted"], granted_at:nil, rebate_type:"").where.not(installment_month:nil).last
- rebates = CashRebate.where(state:["complete","forfeit","granted"], granted_at:nil, rebate_type:"").where.not(installment_month:nil).each do |cr|
- cr.assign_attributes(granted_at: cr.created_at)
- cr.save!(validate:false)
- end; rebates.length
- rebate_types = CashRebate::AD_HOC_REBATE_TYPES + CashRebate::SCHEDULED_REBATE_TYPES + [""]
- CashRebate.where(state:["complete","forfeit","granted"], granted_at:nil).where.not(installment_month:nil, rebate_type: rebate_types).count
- CashRebate.where(state:["complete","forfeit","granted"], granted_at:nil).where.not(installment_month:nil, rebate_type: rebate_types).first
- CashRebate.where(state:["complete","forfeit","granted"], granted_at:nil).where.not(installment_month:nil, rebate_type: rebate_types).last
- rebates = CashRebate.where(state:["complete","forfeit","granted"], granted_at:nil).where.not(installment_month:nil, rebate_type: rebate_types).each do |cr|
- cr.assign_attributes(granted_at: cr.created_at)
- cr.save!(validate:false)
- end; rebates.length
- CashRebate.where(state:["complete"], applied_at:nil).last
- CashRebate.where(state:["complete"], applied_at:nil, rebate_type:"Settlement").count
- CashRebate.where(state:["complete"], applied_at:nil, rebate_type:"Settlement").first
- CashRebate.where(state:["complete"], applied_at:nil, rebate_type:"Settlement").last
- rebates = CashRebate.where(state:["complete"], applied_at:nil, rebate_type:"Settlement").each do |cr|
- cr.assign_attributes(applied_at: cr.created_at)
- cr.save!(validate:false)
- end; rebates.length
- CashRebate.where(state:["complete"], applied_at:nil, rebate_type:"").count
- CashRebate.where(state:["complete"], applied_at:nil, rebate_type:"").first
- CashRebate.where(state:["complete"], applied_at:nil, rebate_type:"").last
- rebates = CashRebate.where(state:["complete"], applied_at:nil, rebate_type:"").each do |cr|
- cr.assign_attributes(applied_at: cr.date_of_processing.to_datetime)
- cr.save!(validate:false)
- end; rebates.length
Add Comment
Please, Sign In to add comment