Skip to content

Commit c0fa57c

Browse files
committed
dont add activities for tasks which dont award points
1 parent c4bdbb5 commit c0fa57c

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Bugs we fixed:
44

55
* Don't redirect user to Progress Planner dashboard if 'redirect_to' GET or POST parameter is set.
66
* Fixed detecting creation of new valuable content posts.
7+
* Don't award point for all Todo tasks, only for golden.
78

89
= 1.4.2 =
910

classes/class-suggested-tasks.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,14 @@ public function suggested_task_action() {
581581
// Mark the task as completed.
582582
$this->mark_task_as( 'completed', $task_id );
583583

584-
// Insert an activity.
585-
$this->insert_activity( $task_id );
584+
$task_data = \progress_planner()->get_suggested_tasks()->get_tasks_by( 'task_id', $task_id );
585+
586+
// Insert an activity if task has points.
587+
// User tasks have points saved in the task data (0 or 1). Other tasks don't, but they all award points.
588+
if ( isset( $task_data[0] ) && ( ( 'user' !== $task_data[0]['provider_id'] || ( ( isset( $task_data[0]['points'] ) && 0 !== (int) $task_data[0]['points'] ) ) ) ) ) {
589+
$this->insert_activity( $task_id );
590+
}
591+
586592
$updated = true;
587593
break;
588594

0 commit comments

Comments
 (0)