Skip to content

course.quiz.listSubmissions(options) doesn't return results with multi-page results set #23

@kevintechie

Description

@kevintechie

The course.quiz.listSubmissions(options) method doesn't return any results when visitEndpoint returns multi-page results. This happens because, with multi-page result sets, visitEndpoint() returns an array of objects and not an object that contains a quiz_submissions key.

See code at line:

return Promise.resolve(response.quiz_submissions);

I haven't checked other methods that check multi-page results return results properly, but suspect the listSubmissions() method is not the only one.

The root of the problem is that genVisitEndpoint() doesn't return an array if there is only one page of results. This is unfortunate as it complicates how to handle its return value by calling code.

See code starting at line:

If genVisitEndpoint() always returned an array, calling code could easily flatten single or multi-page results (e.g.: [].concat(...response.map(({ quiz_submissions }) => quiz_submissions))) or unwrap when a single result is expected (e.g.: response[0].key).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions