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 = {
schedule: {
...scheduleDetail.schedule,
startDate: '2026-08-09',
targetDate: '2026-08-13',
assignmentCount: 4,
days: [
{ date: '2026-08-09', assignments: [] },
scheduleDetail.schedule.days[0],
scheduleDetail.schedule.days[1],
{
@ -298,6 +300,7 @@ describe('set scheduling', () => {
})
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', {
statusCode: 200,
body: bibleLayout,
@ -518,6 +521,7 @@ describe('set scheduling', () => {
cy.get('[data-schedule-date="2026-08-10"]')
.should('contain.text', 'Overdue')
.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"]')
.should('contain.text', 'Rest day')
.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('[data-assignment-section="remaining"] [data-schedule-day]').then(($days) => {
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-16',
])
@ -689,6 +689,7 @@ describe('set scheduling', () => {
it('completes and reopens assignments from the schedule', () => {
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', {
statusCode: 200,
body: completedScheduleDetail,
@ -733,7 +734,7 @@ describe('set scheduling', () => {
cy.get('[data-assignment-section="remaining"]')
.should('have.attr', 'data-assignment-count', '0')
.and('contain.text', 'All assignments are complete.')
.and('contain.text', 'Rest day')
.and('not.contain.text', 'Rest day')
cy.get('[data-assignment-section="completed"]')
.should('have.attr', 'data-assignment-count', '2')
.within(() => {

View file

@ -42,9 +42,9 @@ const remainingDays = computed<ScheduleDay[]>(() => {
return schedule.days.flatMap((day) => {
const assignments = day.assignments.filter((assignment) => assignment.completedAt === null)
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 }] : []
})
})