Fixed chore skip handling via /choresoverview (references #1830)

This commit is contained in:
Bernd Bestel 2022-03-23 18:22:50 +01:00
parent 5dc745f301
commit 9db66048d1
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300

View File

@ -94,13 +94,25 @@ $(document).on('click', '.track-chore-button', function(e)
var choreName = $(e.currentTarget).attr('data-chore-name'); var choreName = $(e.currentTarget).attr('data-chore-name');
var skipped = $(e.currentTarget).hasClass("skip"); var skipped = $(e.currentTarget).hasClass("skip");
Grocy.Api.Get('objects/chores/' + choreId, Grocy.Api.Get('chores/' + choreId,
function(chore) function(choreDetails)
{ {
var trackedTime = moment().format('YYYY-MM-DD HH:mm:ss'); var trackedTime = moment().format('YYYY-MM-DD HH:mm:ss');
if (chore.track_date_only == 1) if (skipped)
{ {
trackedTime = moment().format('YYYY-MM-DD'); trackedTime = moment(choreDetails.next_estimated_execution_time).format('YYYY-MM-DD HH:mm:ss');
}
if (choreDetails.chore.track_date_only == 1)
{
if (skipped)
{
trackedTime = moment(choreDetails.next_estimated_execution_time).format('YYYY-MM-DD');
}
else
{
trackedTime = moment().format('YYYY-MM-DD');
}
} }
Grocy.Api.Post('chores/' + choreId + '/execute', { 'tracked_time': trackedTime, 'skipped': skipped }, Grocy.Api.Post('chores/' + choreId + '/execute', { 'tracked_time': trackedTime, 'skipped': skipped },