Fix incorrect date for graded discussions with todo dates

A graded discussion can have a todo date if it was converted
from an ungraded discussion to a graded discussion. In that
case we should not show to todo date on the modules page.

fixes LX-1964
flag=none

test plan:
- create an ungraded discussion and check the 'add to student
  to do' box and add a date
- create a module and add the ungraded discussion to it
- expect to see the to do date on the module item
- go back to the discussion and change it from ungraded
  to graded
- check the modules page, expect to see no date on the
  discussion module item
- add a due date to the discussion and return to the module
  page
- expect to see the due date on the discussion module item

Change-Id: If32c99af3aa5c49137a2e99593b090d30360dd8c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/355009
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Robin Kuss <rkuss@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Sarah Gerard <sarah.gerard@instructure.com>
This commit is contained in:
Sarah Gerard 2024-08-13 16:38:50 -07:00
parent f624a48470
commit aa648cb76b
2 changed files with 11 additions and 1 deletions

View File

@ -216,6 +216,16 @@ describe "context modules" do
expect(f(".due_date_display").text).to eq date_string(todo_date, :no_words)
end
it "does not show the todo date on an graded discussion in a module", priority: "2" do
due_at = 3.days.from_now
todo_date = 3.days.from_now
@assignment = @course.assignments.create!(name: "assignemnt", due_at:)
@discussion = @course.discussion_topics.create!(title: "Graded Discussion", assignment: @assignment, todo_date:)
@mod.add_item(type: "discussion_topic", id: @discussion.id)
go_to_modules
expect(f(".due_date_display").text).to eq date_string(due_at, :no_words)
end
it "edits available/until dates on a ungraded discussion in a module", priority: "2" do
available_from = 2.days.from_now
available_until = 4.days.from_now

View File

@ -302,7 +302,7 @@ window.modules = (function () {
}
if (ENV.IN_PACED_COURSE && !ENV.IS_STUDENT) {
$context_module_item.find('.due_date_display').remove()
} else if (info.todo_date != null) {
} else if (info.todo_date != null && info.points_possible == null) {
data.due_date_display = dateString(info.todo_date)
} else if (info.due_date != null) {
if (info.past_due != null) {