added script to close grants

This commit is contained in:
Adrian Hinz 2022-06-03 21:01:57 +02:00
parent 2f1347a340
commit 4e711f73f4
1 changed files with 18 additions and 0 deletions

View File

@ -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