6851a9ee52
`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)
15 lines
318 B
Ruby
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
|