Skip to content

Commit 6b4dad8

Browse files
committed
👌 IMPROVE: Tasks - Fix some cases where the tasks don't have valid dates (due to API inconsistencies)
1 parent 39306dc commit 6b4dad8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

‎classes/api_data.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,8 @@ private function store_tasks( $filter, $page ) {
431431
// Some simple rules to automatically detect the correct flag for tasks.
432432
if ( 'canceled' === $task['state'] ) {
433433
// Tasks that were canceled by the client obviously are lost.
434-
$new_task['flag'] = 'lost';
434+
$new_task['flag'] = 'lost';
435+
$new_task['last_activity'] = (int) strtotime( $task['published_at'] );
435436
} elseif ( $new_task['hidden'] ) {
436437
// Tasks that I hide from my Codeable list are "lost for us".
437438
$new_task['flag'] = 'lost';
@@ -448,8 +449,9 @@ private function store_tasks( $filter, $page ) {
448449
}
449450
} elseif ( empty( $new_task['last_activity'] ) ) {
450451
// This workroom is private for another expert = possibly lost.
451-
if ( in_array( $task['state'], [ 'hired', 'completed', 'refunded' ], true ) ) {
452-
$new_task['flag'] = 'lost';
452+
if ( in_array( $task['state'], [ 'hired', 'completed', 'refunded', 'paid' ], true ) ) {
453+
$new_task['flag'] = 'lost';
454+
$new_task['last_activity'] = (int) strtotime( $task['published_at'] );
453455
}
454456
}
455457

0 commit comments

Comments
 (0)