Skip to content

Commit

Permalink
clean-up disabled check
Browse files Browse the repository at this point in the history
  • Loading branch information
venix12 committed Jan 30, 2024
1 parent 361ce23 commit 60441c9
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions resources/js/contest-judge/entry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,16 @@ export default class Entry extends React.Component<Props> {
@computed
private get disabled() {
const scoresHaveChanged = this.props.store.scoringCategories.some((category) => {
const score = this.currentVote.scores.get(category.id);
if (score == null) return false;

const initialScore = this.initialVote.scores.get(category.id);
if (initialScore?.value !== score.value) return true;
const score = this.currentVote.scores.get(category.id);

return false;
return initialScore?.value !== score?.value;
});

if (
!scoresHaveChanged &&
this.currentVote.comment === this.initialVote.comment
) return true;

return false;
return !(
this.currentVote.scores.size === this.props.store.scoringCategories.length
&& (scoresHaveChanged || this.currentVote.comment !== this.initialVote.comment)
);
}

render() {
Expand Down

0 comments on commit 60441c9

Please sign in to comment.