Skip to content

Commit

Permalink
Compress dates when switching from course to student plan if necessary.
Browse files Browse the repository at this point in the history
closes LS-2965
flag=pace_plans

test plan:
  - in a course with a pace plan
  - set end date so the dates are being compressed
  - switch from course plan to a student plan
  > expect the compress_dates api to get called
  > expect the plan to show compressed dates

Change-Id: Ibfe91c20c28aa049b5a6ecfae9a9e50003e2cdae
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286503
Tested-by: Service Cloud Jenkins <[email protected]>
Reviewed-by: Jackson Howe <[email protected]>
QA-Review: Jackson Howe <[email protected]>
Product-Review: Ed Schiebel <[email protected]>
  • Loading branch information
eschiebel committed Mar 8, 2022
1 parent f79fc79 commit 3515d7e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,25 @@ describe('ProjectedDates', () => {
expect(defaultProps.uncompressDates).not.toHaveBeenCalled()
expect(defaultProps.compressDates).toHaveBeenCalled()
})

it('calls compressDates when switching from course to student plan and squshing is necessary', () => {
// the course ends on 2021-12-31
const pp = {...defaultProps.pacePlan}
pp.hard_end_dates = false
pp.end_date = undefined
const ped = '2022-01-01'
const {rerender} = renderConnected(
<ProjectedDates {...defaultProps} pacePlan={pp} projectedEndDate={ped} />
)

expect(defaultProps.compressDates).toHaveBeenCalledTimes(1)

pp.context_id = '1'
pp.context_type = 'Enrollment'
rerender(<ProjectedDates {...defaultProps} pacePlan={pp} projectedEndDate={ped} />)

expect(defaultProps.compressDates).toHaveBeenCalledTimes(2)
})
})

describe('specified end date checkbox', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ export const ProjectedDates: React.FC<ComponentProps> = ({
pacePlan.end_date,
pacePlan.hard_end_dates,
pacePlan.start_date,
pacePlan.context_id,
pacePlan.context_type,
projectedEndDate,
uncompressDates
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const Module: React.FC<PassedProps> = props => {
<ColHeader width={actuallyExpanded ? '9.5em' : '0'} id={`module-${props.module.id}-duration`}>
<Flex as="div" alignItems="end" justifyItems="center" padding={headerPadding}>
{I18n.t('Due Date')}
{!isStudentPlan && props.isCompressing && (
{props.isCompressing && (
<View data-testid="duedate-tooltip" as="span" margin="0 0 0 x-small">
<Tooltip
renderTip={I18n.t(
Expand Down

0 comments on commit 3515d7e

Please sign in to comment.