Skip to content

Commit

Permalink
Add check for the existence of scorer before updating. (#1093)
Browse files Browse the repository at this point in the history
  • Loading branch information
epugh authored Nov 1, 2024
1 parent b56225e commit b131549
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 7.18.1 - 2024-11-01

### Bugs

* If you don't have `P@10` defined, the migrations blow up. Thanks @frutik for find the bug. https://github.com/o19s/quepid/pull/1093

## 7.18.0 - 2024-10-04

Wow! It's been three months since the last release of Quepid, so it's about time.
Expand Down
8 changes: 5 additions & 3 deletions db/migrate/20240626181338_reindex_p_at10_code.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ def change
scorers_to_update = ['P@10']
scorers_to_update.each do |scorer_name|
scorer = Scorer.where(name: scorer_name, communal: true).first
name = scorer.name
scorer.code = File.readlines("./db/scorers/#{name.downcase}.js",'\n').join('\n')
scorer.save!
if scorer != nil # One user did not have P@10 defined, so this migration blows up. Don't assume they have it.
name = scorer.name
scorer.code = File.readlines("./db/scorers/#{name.downcase}.js",'\n').join('\n')
scorer.save!
end
end
end
end

0 comments on commit b131549

Please sign in to comment.