Christopher Johnson (WMDE) has submitted this change and it was merged.

Change subject: fix point change transaction formula
......................................................................


fix point change transaction formula

Changed to look at the "new" point value for the transaction,
The old formula was looking at the "current" point value.

Change-Id: I7a4861d97846e6994793ca4b60821737108164ee
---
M src/storage/SprintTransaction.php
1 file changed, 8 insertions(+), 8 deletions(-)

Approvals:
  Christopher Johnson (WMDE): Verified; Looks good to me, approved



diff --git a/src/storage/SprintTransaction.php 
b/src/storage/SprintTransaction.php
index f760be1..03c65af 100644
--- a/src/storage/SprintTransaction.php
+++ b/src/storage/SprintTransaction.php
@@ -26,6 +26,8 @@
 
       if (in_array($project_phid, $project_phids)) {
         $points = $query->getStoryPoints($task_phid);
+        $old_point_value = $xaction->getOldValue();
+        $new_point_value = $xaction->getNewValue();
         $date = phabricator_format_local_time($xaction_date, $this->viewer, 'D 
M j');
 
 
@@ -48,8 +50,7 @@
               break;
             case "points":
               // Points were changed
-                $old_point_value = $xaction->getOldValue();
-                $this->ChangePointsBefore($before, $points, $old_point_value, 
$dates);
+                 $this->ChangePointsBefore($before, $new_point_value, 
$old_point_value);
                  break;
           }
         }
@@ -88,8 +89,7 @@
             case "points":
 //              $this->transLog($event);
               // Points were changed
-                $old_point_value = $xaction->getOldValue();
-                $this->changePoints($date, $task_phid, $points, 
$old_point_value, $dates);
+                $this->changePoints($date, $task_phid, $new_point_value, 
$old_point_value, $dates);
 //                $this->closePoints($date, $task_phid, $points, 
$old_point_value, $dates);
               break;
           }
@@ -153,8 +153,8 @@
     return $dates;
   }
 
-  private function ChangePointsBefore($before, $points,  $old_point_value) {
-    $points = $points - $old_point_value;
+  private function ChangePointsBefore($before, $new_point_value,  
$old_point_value) {
+    $points = $new_point_value - $old_point_value;
     $before->setPointsAddedBefore($points);
   }
 
@@ -178,10 +178,10 @@
     return $this->task_in_sprint[$task_phid];
   }
 
-  private function changePoints($date, $task_phid, $points, $old_point_value, 
$dates) {
+  private function changePoints($date, $task_phid, $new_point_value, 
$old_point_value, $dates) {
 
     // Adjust points for that day
-    $this->task_points[$task_phid] = $points - $old_point_value;
+    $this->task_points[$task_phid] = $new_point_value - $old_point_value;
     $dates[$date]->setPointsAddedToday($this->task_points[$task_phid]);
     return $dates;
   }

-- 
To view, visit https://gerrit.wikimedia.org/r/177769
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7a4861d97846e6994793ca4b60821737108164ee
Gerrit-PatchSet: 2
Gerrit-Project: phabricator/extensions/Sprint
Gerrit-Branch: master
Gerrit-Owner: Christopher Johnson (WMDE) <[email protected]>
Gerrit-Reviewer: Christopher Johnson (WMDE) <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to