Browse Source

Fix delete error.

pull/6/head
t123yh 7 years ago
parent
commit
861a23e67e
  1. 3
      models/rating_calculation.js

3
models/rating_calculation.js

@ -52,11 +52,12 @@ class RatingCalculation extends Model {
async delete() {
const RatingHistory = syzoj.model('rating_history');
const histories = await RatingHistory.query(null, {
rating_calculation_id: this.rating_calculation_id
rating_calculation_id: this.id
});
for (const history of histories) {
await history.loadRelationships();
const user = history.user;
console.log("Destroying history for user " + user.id);
await history.destroy();
const ratingItem = (await RatingHistory.findOne({
where: { user_id: user.id },

Loading…
Cancel
Save