diff --git a/internal/web_server/handlers/questions.go b/internal/web_server/handlers/questions.go index 3141599..c693bbe 100644 --- a/internal/web_server/handlers/questions.go +++ b/internal/web_server/handlers/questions.go @@ -1563,15 +1563,18 @@ func (h *Handler) CompletePractice(c *fiber.Ctx) error { Error: setErr.Error(), }) } - if !strings.EqualFold(set.SetType, string(domain.QuestionSetTypePractice)) || !strings.EqualFold(set.Status, "PUBLISHED") { + if !strings.EqualFold(set.SetType, string(domain.QuestionSetTypePractice)) { return c.Status(fiber.StatusNotFound).JSON(domain.ErrorResponse{Message: "Practice not found"}) } - if err := h.enforcePracticeSequenceForStudent(c, set); err != nil { - return c.Status(fiber.StatusForbidden).JSON(domain.ErrorResponse{ - Message: "You must complete previous practices first", - Error: err.Error(), - }) + // Enforce sequential gating only for published practices. + if strings.EqualFold(set.Status, "PUBLISHED") { + if err := h.enforcePracticeSequenceForStudent(c, set); err != nil { + return c.Status(fiber.StatusForbidden).JSON(domain.ErrorResponse{ + Message: "You must complete previous practices first", + Error: err.Error(), + }) + } } if err := h.lmsProgressSvc.CompletePracticeForUser(c.Context(), userID, set.ID); err != nil {