fix: prioritize student branch when both student_id and teacher_id present

The daka query branching checked teacher_id first. When a student
has currentTeacherId set, both params are present, causing the
teacher branch to activate (requires scope) and fail with
"scope can not be none". Fixed by adding student_id.is_none()
to the teacher branch condition.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-01 00:42:09 +08:00
parent 2a2f32401a
commit ce61c8b7d0
+1 -1
View File
@@ -855,7 +855,7 @@ pub async fn raw_find_dakas_with_sections_by_user_id(
let dakas_with_pages: (Vec<Daka>, i64, i64);
let dakas: Vec<Daka>;
if teacher_id.is_some() {
if teacher_id.is_some() && student_id.is_none() {
match scope {
&Some(string_ref) => match string_ref.as_str() {
"ALL" => {