Instructor v2 grading-config returns an HTML debug dump, but its spec says JSON GradingConfig

未关闭
#39,212 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
javascript, python
领域
api, backend

调研方向

Start in GradingConfigView in lms/djangoapps/instructor/views/api_v2.py, where the HTML response from instructor_analytics.basic.dump_grading_context is returned, and compare it with the getGradingConfig entry in instructor-v2-grading-api-spec.yaml. Done means either a JSON GradingConfig built from course.grading_policy (GRADER and GRADE_CUTOFFS), or an updated spec and MFE handling of the preformatted text. The issue leaves the choice between these open, so confirm it with a maintainer before writing code.

由索引模型根据 Issue 内容生成。

描述

bug

GET /api/instructor/v2/courses/<course_key>/grading-config returns text/html: the v1 debugging dump from instructor_analytics.basic.dump_grading_context, wrapped in <pre>…</pre>. The published v2 spec describes it differently: instructor-v2-grading-api-spec.yaml (getGradingConfig) says it produces application/json matching the GradingConfig schema (graders[] with type/min_count/drop_count/weight, plus grade_cutoffs).

The view's docstring (GradingConfigView, lms/djangoapps/instructor/views/api_v2.py:2834) calls the HTML deliberate, carried over from v1 "so the MFE can render it directly inside a <pre> block". But the MFE doesn't render it as HTML. frontend-app-instructor-dashboard passes the response to a CodeEditor in the "View Grading Configuration" modal, so instructors see the raw dump, <pre> tags included, with Python class reprs such as <class 'xmodule.graders.WeightedSubsectionsGrader'>.

Every other endpoint in the v2 instructor API returns JSON, and #38989 (CCX grading policy) was written assuming this one did too.

Suggested fix: implement the endpoint as specified, returning JSON GradingConfig built from course.grading_policy (GRADER + GRADE_CUTOFFS), and have the MFE render that. If the HTML dump is meant to stay, update the spec and the MFE to treat it as preformatted text.

Environment: Tutor main, 2026-09-15; code references are to master @ 2e46ebdf50.

Found by the Open edX end-to-end test suite (INSTR-003).

主要语言
Python
星标
8.2k
派生
4.4k
平均合并
2 天 10 小时
30 天内合并 PR
40

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

openedx/openedx-platform 的其他 Issue

查看 openedx/openedx-platform 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。