Skip to content

Commit

Permalink
tag_opdb_changelog daily rake task
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanTG committed Feb 3, 2025
1 parent 581787a commit 078be08
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
4 changes: 4 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
"command": "rake notify_operators",
"schedule": "30 15 * * *"
},
{
"command": "rake tag_opdb_changelog",
"schedule": "30 13 * * *"
},
{
"command": "rake delete_opted_in_empty_locations",
"schedule": "30 22 * * 0"
Expand Down
16 changes: 15 additions & 1 deletion app/models/machine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,21 @@ def self.tag_with_opdb_type_json(opdb_json)
end
end

def self.tag_with_opdb_json(opdb_json)
def self.tag_with_opdb_changelog_json(opdb_json)
JSON.parse(opdb_json).each do |r|
m = Machine.find_by_opdb_id(r["opdb_id_deleted"])
next unless m

if r["action"] == "move"
m.opdb_id = r["opdb_id_replacement"]
elsif r["action"] == "delete"
m.opdb_id = ""
end
m.save
end
end

def self.tag_with_opdb_image_json(opdb_json)
JSON.parse(opdb_json).each do |r|
m = Machine.find_by_opdb_id(r["opdb_id"])
next unless m
Expand Down
9 changes: 0 additions & 9 deletions lib/tasks/tag_opdb.rake

This file was deleted.

0 comments on commit 078be08

Please sign in to comment.