demarches-normaliennes/app/services/falsify_opendata_service.rb
Christophe Robillard 6851a9ee52 falsify opendata flag for some procedures
`procedures:falsify_opendata_procedures` rake task allows to falsify
opndata flag for procedures listed in csv file given in input (with only
one column : id column)
2023-03-01 11:47:11 +01:00

15 lines
318 B
Ruby

class FalsifyOpendataService
def self.call(lines)
errors = []
lines.each do |line|
id = line["id"]
procedure = Procedure.find_by(id: id)
if procedure
procedure.update(opendata: false)
else
errors << "Procedure #{id} introuvable"
end
end
errors
end
end