Skip to content

Commit d9280c8

Browse files
Remove requirement for task completion when report (#229)
Co-authored-by: Felix <[email protected]>
1 parent f5157f3 commit d9280c8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

challenges/src/endpoints/subtasks/reports.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl Api {
8181
}
8282

8383
let user_subtask = get_user_subtask(&db, auth.0.id, subtask.id).await?;
84-
if !user_subtask.can_rate(&auth.0, &subtask) {
84+
if !user_subtask.can_report(&auth.0, &subtask) {
8585
return CreateReport::permission_denied();
8686
}
8787

challenges/src/services/subtasks.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,10 @@ pub trait UserSubtaskExt {
259259
user.id != subtask.creator && self.is_solved() && !self.is_rated()
260260
}
261261

262+
fn can_report(&self, user: &User, subtask: &challenges_subtasks::Model) -> bool {
263+
user.id != subtask.creator && !self.is_rated()
264+
}
265+
262266
fn attempted(&self) -> bool {
263267
self.last_attempt().is_some()
264268
}

0 commit comments

Comments
 (0)