Skip to content

[tui] catalog course/section list shows internal id, but 'view' requires jwId — browse→view workflow broken #15

Description

@tiankaima

Summary

catalog course list / catalog section list (and their TUIs) print an ID column containing the internal id, but catalog course view <jw-id> / catalog section view <jw-id> look up by the registrar-assigned jwId. The copy-paste workflow the CLI invites — list something, copy its ID, view it — fails.

Evidence

  • internal/cmd/course/course.go:124-131: courseListColumns() = {Code, Name, Level, ID: "id"}
  • internal/cmd/course/course.go:157-172: view <jw-id>GetCourse(ctx, jwId)GET /api/courses/{jwId}
  • internal/cmd/section/section.go:159 shows ID: "id"; section.go:192-205 view <jw-id>GetSection(ctx, jwId)
  • api/openapi.json: courseDetailSchema carries both id and jwId (distinct key spaces); GET /api/courses/{jwId} is parameterized on jwId.

So a user who runs life-ustc catalog course, sees e.g. ID = 4521, and runs life-ustc catalog course view 4521 gets a 404 (or the wrong record if the spaces collide), because 4521 was the internal id, not the jwId. (catalog teacher is consistent — list shows id and teacher view takes the internal id — so this affects course and section only.)

Suggested fix

Show jwId (as JW ID or replacing ID) in course/section list columns and in the TUI result tables, and/or accept both identifier kinds in view (e.g. try jwId then fall back to internal id). The TUI drill-down proposed in #14 would also need the jwId to be carried in the row.

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