Compare commits

..

3 commits

Author SHA1 Message Date
0b4465ec47
Merge branch 'feature/hide-past-rest' 2026-08-22 23:05:00 +03:00
33fa8ffffc
hide past rest days 2026-08-22 22:58:11 +03:00
9c604e9455
test past rest day filtering 2026-08-22 22:56:40 +03:00
2 changed files with 8 additions and 7 deletions

View file

@ -138,9 +138,11 @@ const completedScheduleDetail = {
const splitScheduleDetail = { const splitScheduleDetail = {
schedule: { schedule: {
...scheduleDetail.schedule, ...scheduleDetail.schedule,
startDate: '2026-08-09',
targetDate: '2026-08-13', targetDate: '2026-08-13',
assignmentCount: 4, assignmentCount: 4,
days: [ days: [
{ date: '2026-08-09', assignments: [] },
scheduleDetail.schedule.days[0], scheduleDetail.schedule.days[0],
scheduleDetail.schedule.days[1], scheduleDetail.schedule.days[1],
{ {
@ -298,6 +300,7 @@ describe('set scheduling', () => {
}) })
it('creates a schedule from a set and shows every day', () => { it('creates a schedule from a set and shows every day', () => {
cy.clock(new Date(2026, 7, 10, 12).getTime(), ['Date'])
cy.intercept('GET', '**/api/sets/41', { cy.intercept('GET', '**/api/sets/41', {
statusCode: 200, statusCode: 200,
body: bibleLayout, body: bibleLayout,
@ -518,6 +521,7 @@ describe('set scheduling', () => {
cy.get('[data-schedule-date="2026-08-10"]') cy.get('[data-schedule-date="2026-08-10"]')
.should('contain.text', 'Overdue') .should('contain.text', 'Overdue')
.and('contain.text', 'Genesis / Creation / Chapter 1') .and('contain.text', 'Genesis / Creation / Chapter 1')
cy.get('[data-schedule-date="2026-08-09"]').should('not.exist')
cy.get('[data-schedule-date="2026-08-11"]') cy.get('[data-schedule-date="2026-08-11"]')
.should('contain.text', 'Rest day') .should('contain.text', 'Rest day')
.and('not.contain.text', 'Overdue') .and('not.contain.text', 'Overdue')
@ -607,10 +611,6 @@ describe('set scheduling', () => {
cy.get('.schedule-range').should('contain.text', 'Aug 10, 2026 to Aug 16, 2026') cy.get('.schedule-range').should('contain.text', 'Aug 10, 2026 to Aug 16, 2026')
cy.get('[data-assignment-section="remaining"] [data-schedule-day]').then(($days) => { cy.get('[data-assignment-section="remaining"] [data-schedule-day]').then(($days) => {
expect([...$days].map((day) => day.getAttribute('data-schedule-date'))).to.deep.equal([ expect([...$days].map((day) => day.getAttribute('data-schedule-date'))).to.deep.equal([
'2026-08-11',
'2026-08-12',
'2026-08-13',
'2026-08-14',
'2026-08-15', '2026-08-15',
'2026-08-16', '2026-08-16',
]) ])
@ -689,6 +689,7 @@ describe('set scheduling', () => {
it('completes and reopens assignments from the schedule', () => { it('completes and reopens assignments from the schedule', () => {
const completedAt = '2026-08-15T12:30:00+00:00' const completedAt = '2026-08-15T12:30:00+00:00'
cy.clock(new Date(2026, 7, 15, 12).getTime(), ['Date'])
cy.intercept('GET', '**/api/schedules/73', { cy.intercept('GET', '**/api/schedules/73', {
statusCode: 200, statusCode: 200,
body: completedScheduleDetail, body: completedScheduleDetail,
@ -733,7 +734,7 @@ describe('set scheduling', () => {
cy.get('[data-assignment-section="remaining"]') cy.get('[data-assignment-section="remaining"]')
.should('have.attr', 'data-assignment-count', '0') .should('have.attr', 'data-assignment-count', '0')
.and('contain.text', 'All assignments are complete.') .and('contain.text', 'All assignments are complete.')
.and('contain.text', 'Rest day') .and('not.contain.text', 'Rest day')
cy.get('[data-assignment-section="completed"]') cy.get('[data-assignment-section="completed"]')
.should('have.attr', 'data-assignment-count', '2') .should('have.attr', 'data-assignment-count', '2')
.within(() => { .within(() => {

View file

@ -42,9 +42,9 @@ const remainingDays = computed<ScheduleDay[]>(() => {
return schedule.days.flatMap((day) => { return schedule.days.flatMap((day) => {
const assignments = day.assignments.filter((assignment) => assignment.completedAt === null) const assignments = day.assignments.filter((assignment) => assignment.completedAt === null)
const isActiveDate = day.date >= schedule.startDate && day.date <= schedule.targetDate const isActiveDate = day.date >= schedule.startDate && day.date <= schedule.targetDate
const isRestDay = isActiveDate && day.assignments.length === 0 const isVisibleRestDay = isActiveDate && day.assignments.length === 0 && day.date >= todayDate
return assignments.length > 0 || isRestDay ? [{ date: day.date, assignments }] : [] return assignments.length > 0 || isVisibleRestDay ? [{ date: day.date, assignments }] : []
}) })
}) })