Skip to content

Commit f716b4a

Browse files
committed
check if it's user task and if it awards points
1 parent 709ea35 commit f716b4a

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

classes/activities/class-suggested-task.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,15 @@ public function get_points( $date ) {
6969
$tasks = \progress_planner()->get_suggested_tasks()->get_tasks_by( 'task_id', $this->data_id );
7070

7171
if ( ! empty( $tasks ) && isset( $tasks[0]['provider_id'] ) ) {
72-
$task_provider = \progress_planner()->get_suggested_tasks()->get_tasks_manager()->get_task_provider( $tasks[0]['provider_id'] );
72+
if ( 'user' === $tasks[0]['provider_id'] ) {
73+
$points = isset( $tasks[0]['points'] ) ? (int) $tasks[0]['points'] : 0;
74+
} else {
75+
$task_provider = \progress_planner()->get_suggested_tasks()->get_tasks_manager()->get_task_provider( $tasks[0]['provider_id'] );
7376

74-
if ( $task_provider ) {
75-
// Create post task provider had a different points system, this is for backwards compatibility.
76-
$points = $task_provider instanceof Content_Create ? $task_provider->get_points( $this->data_id ) : $task_provider->get_points();
77+
if ( $task_provider ) {
78+
// Create post task provider had a different points system, this is for backwards compatibility.
79+
$points = $task_provider instanceof Content_Create ? $task_provider->get_points( $this->data_id ) : $task_provider->get_points();
80+
}
7781
}
7882
}
7983
$this->points[ $date_ymd ] = $points;

0 commit comments

Comments
 (0)