Alice Technical Journal — Homework Progress, Media Stability & Debugging

1) Customers > Homework Detail — Link Progress Error Debugging

  • Encountered an issue where parents click a checkbox to mark a link as completed and receive:“Không thể cập nhật tiến độ. Vui lòng thử lại”
  • Error occurs silently without clear context.
  • Decision: add deep backend observability, not UI changes yet.

Action

  • In the link-progress update endpoint:
    • Added structured logging at every step:
      • request received
      • authorization
      • validation
      • homework + link resolution
      • database write
      • skill status recalculation
      • final response
  • All logs are written to a dedicated log channel: homework-proof.
  • Goal: trace exactly where and why progress update fails (auth, data mismatch, race condition, DB constraint).

2) Customers > Homework Detail — Video Upload Stability

  • Observed cases where:
    • Video upload shows loading
    • Loading stops silently
    • No error or confirmation shown
  • Root issue suspected to be lack of backend context during upload.

Action

  • Added extensive backend logging (also to homework-proof) for the full video upload lifecycle:
    • request metadata (user, student, homework, skill, file info)
    • validation outcome
    • temp file handling
    • R2 upload start/end
    • DB record creation/update
    • delayed job dispatch
    • final response
  • This ensures silent failures can be reconstructed step by step.

3) Customers > Homework Detail — Video Upload UX Fixes (Confirmed)

  • Upload behavior finalized:
    • Original video uploads to R2 only.
    • Immediate UI feedback shows “Upload thành công”.
    • No infinite spinner.
  • Background processing job delay reduced:
    • from 1 hour → 1 minute.
  • UI relies on persisted DB status, not frontend timers.

4) Admin > Academic > Homework — SQL Error Fix

  • Hit SQL error when saving homework:Column 'id' in field list is ambiguous
  • Cause:
    • Join between students and homework_students
    • Query used select id instead of qualified column.

Action

  • Fixed queries to explicitly select:
    • students.id
    • or alias as student_id
  • Audited similar joins to prevent future ambiguity.
  • Homework save flow stabilized.

5) Teacher Controller Runtime Error Fix

  • Encountered runtime error:Undefined variable $teacherId
  • Cause:
    • $teacherId referenced without being defined in controller scope.

Action

  • Standardized teacher identity retrieval:
    • $teacherId = auth()->id();
  • Added role guard for Teacher context.
  • Removed assumptions of implicit variables.

6) Admin > Academic > Tasks — Recurrence Regression Fix

  • Adding Daily recurrence accidentally removed Weekly recurrence.
  • This caused feature regression.

Action

  • Restored Weekly recurrence.
  • Supported both Daily and Weekly recurrence modes.
  • Admin can now choose exactly one:
    • No recurrence
    • Daily
    • Weekly
  • Ensured:
    • backward compatibility with existing weekly tasks
    • recurrence changes affect future instances only

7) Android (Samsung) — Media Picker Bug

  • On some Android devices (e.g. Samsung S25):
    • File picker only showed images when uploading proof.
  • Cause:
    • restrictive <input type="file"> configuration.

Action

  • Updated file input to:
    • accept="image/*,video/*"
  • Removed capture flags that force image-only mode.
  • Confirmed compatibility with:
    • Android Chrome
    • iOS Safari
    • Desktop browsers

8) Admin > Homework Detail — Proof Review Enhancements (Stabilized)

  • Proof viewing logic finalized:
    • If optimized video exists → play optimized
    • If still processing → fallback to original video
  • Ensured no blocking “processing” state for Admin.
  • Video preview aspect ratio fixed (no stretching).

Summary

This recent work focused heavily on stability, observability, and regression recovery:

  • Turning silent failures into traceable backend events
  • Fixing runtime and SQL errors
  • Hardening media upload/playback across devices
  • Restoring broken recurrence logic without data loss

The system is now in a debuggable and predictable state, ready for deeper fixes once logs reveal root causes.