Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: treat tasks with STATUS:COMPLETED as completed #2429

Merged
merged 2 commits into from
Jan 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/models/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
* Update linked calendar of this task
*
* @param {object} calendar the calendar
* @memberof Contact

Check warning on line 146 in src/models/task.js

View workflow job for this annotation

GitHub Actions / NPM lint

The type 'Contact' is undefined
*/
updateCalendar(calendar) {
this.calendar = calendar
Expand Down Expand Up @@ -257,7 +257,7 @@
}

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

get complete() {
Expand Down Expand Up @@ -292,7 +292,7 @@
}

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)
})
})
Loading