Skip to content

getProgressByLearner silently ignores limit/offset when courseId absent #14

Description

@DeFiVC

What

When courseId is undefined (the "all courses" path), the function executes a DISTINCT ON (course_id) query that returns all courses for the learner without applying LIMIT or OFFSET. The pagination parameters are silently discarded.

Why

A learner with hundreds of courses would return all records in a single response, causing large payloads and potential memory/performance issues. The API at routes.ts:100-105 passes limit and offset through to this function, giving callers the false impression pagination is supported.

Scope

  • Apply limit and offset to the DISTINCT ON query
  • Or document that pagination is not supported for this path

Acceptance Criteria

  • Pagination is applied consistently
  • Or documentation reflects the actual behavior

Technical Context

  • File: src/database/queries.ts, lines 164-172

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions