Browse Source

Avoid repetitive load relationship.

pull/6/head
t123yh 7 years ago
parent
commit
bee4805d0d
  1. 8
      models/judge_state.js

8
models/judge_state.js

@ -101,8 +101,12 @@ class JudgeState extends Model {
} }
async loadRelationships() { async loadRelationships() {
this.user = await User.fromID(this.user_id); if (!this.user) {
if (this.problem_id) this.problem = await Problem.fromID(this.problem_id); this.user = await User.fromID(this.user_id);
}
if (!this.problem) {
if (this.problem_id) this.problem = await Problem.fromID(this.problem_id);
}
} }
async isAllowedVisitBy(user) { async isAllowedVisitBy(user) {

Loading…
Cancel
Save