added script to close grants
This commit is contained in:
parent
2f1347a340
commit
4e711f73f4
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rubygems'
|
||||||
|
require 'bundler/setup'
|
||||||
|
# require 'mailman'
|
||||||
|
require 'mail'
|
||||||
|
require 'builder'
|
||||||
|
ENV['RAILS_ENV'] ||= 'production'
|
||||||
|
require File.dirname(__FILE__) + '/../config/environment'
|
||||||
|
|
||||||
|
grants = Dotation.where(active: true).where.not(end_date: nil)
|
||||||
|
grants.each do |grant|
|
||||||
|
if grant.end_date < Time.now
|
||||||
|
grant.active = false
|
||||||
|
grant.save
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in New Issue