Optimized tracking button handling on /choresoverview (closes #2186)

This commit is contained in:
Bernd Bestel
2023-03-31 20:12:06 +02:00
parent 3d01854fa1
commit 98469248eb
5 changed files with 21 additions and 8 deletions

View File

@@ -93,19 +93,20 @@ $(document).on('click', '.track-chore-button', function(e)
var choreId = $(e.currentTarget).attr('data-chore-id');
var choreName = $(e.currentTarget).attr('data-chore-name');
var skipped = $(e.currentTarget).hasClass("skip");
var now = $(e.currentTarget).hasClass("now");
Grocy.Api.Get('chores/' + choreId,
function(choreDetails)
{
var trackedTime = moment().format('YYYY-MM-DD HH:mm:ss');
if (skipped)
if ((skipped || !now) && choreDetails.next_estimated_execution_time != null)
{
trackedTime = moment(choreDetails.next_estimated_execution_time).format('YYYY-MM-DD HH:mm:ss');
}
if (choreDetails.chore.track_date_only == 1)
{
if (skipped)
if ((skipped || !now) && choreDetails.next_estimated_execution_time != null)
{
trackedTime = moment(choreDetails.next_estimated_execution_time).format('YYYY-MM-DD');
}