Skip to content

Commit

Permalink
Merge pull request #2429 from nextcloud/fix/2428/missing-completed-prop
Browse files Browse the repository at this point in the history
feat: treat tasks with `STATUS:COMPLETED` as completed
  • Loading branch information
raimund-schluessler committed Jan 1, 2024
2 parents 68f3747 + c540931 commit 1745e48
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/models/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export default class Task {
}

get closed() {
return this._completed || this._status === 'CANCELLED'
return this.completed || this._status === 'CANCELLED'
}

get complete() {
Expand Down Expand Up @@ -292,7 +292,7 @@ export default class Task {
}

get completed() {
return this._completed
return this._completed || this._status === 'COMPLETED'
}

set completed(completed) {
Expand Down
13 changes: 12 additions & 1 deletion tests/assets/loadAsset.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,18 @@ SUMMARY:Test 1
DUE:20151119T183901
END:VTODO
END:VCALENDAR`,

'vcalendars/vcalendar-status-completed': `BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Nextcloud Tasks 0.11.3
BEGIN:VTODO
CREATED:20181119T183919
DTSTAMP:20190918T095816
LAST-MODIFIED:20190918T095816
STATUS:COMPLETED
UID:pwen4kz18g
SUMMARY:Test 1
END:VTODO
END:VCALENDAR`,
}
return vcalendars[assetName]
}
Expand Down
6 changes: 6 additions & 0 deletions tests/javascript/unit/models/task.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,10 @@ describe('task', () => {
task.complete = 100
expect(task.closed).toEqual(true)
})

it('Should show completed when status is completed', () => {
const task = new Task(loadICS('vcalendars/vcalendar-status-completed'), {})
expect(task.closed).toEqual(true)
expect(task.completed).toEqual(true)
})
})

0 comments on commit 1745e48

Please sign in to comment.