Skip to content

Commit 9b7d2ea

Browse files
committed
added total estimation
1 parent d074c51 commit 9b7d2ea

File tree

6 files changed

+16
-10
lines changed

6 files changed

+16
-10
lines changed

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ gtt report:month ["2017-03"] ["namespace/project"]
5151
gtt report:day ["2017-03-01"] ["namespace/project"]
5252
5353
# timeframe
54-
git report --from="2017-03-01" --to="2017-04-01"
54+
gtt report --from="2017-03-01" --to="2017-04-01"
5555
5656
# include closed issues
5757
gtt report --closed=true

src/Output/AbstractOutput.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ abstract class AbstractOutput implements \kriskbx\gtt\Output\OutputInterface
2323
*/
2424
protected $totalTime = 0;
2525

26+
/**
27+
* @var int
28+
*/
29+
protected $totalEstimate = 0;
30+
2631
/**
2732
* @var InputInterface
2833
*/
@@ -78,7 +83,9 @@ public function __construct(
7883
*/
7984
protected function addToTotal(Issue $issue)
8085
{
81-
$issue->getTimes()->each(function ($times, $user) {
86+
$this->totalEstimate += @$issue->getEstimation()->getTimeEstimate() ?: 0;
87+
88+
collect($issue->getTimes())->each(function ($times, $user) {
8289
if ( ! @$this->totalTimeByUser[$user]) {
8390
$this->totalTimeByUser[$user] = 0;
8491
}

src/Output/CsvOutput.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,10 @@
33

44
namespace kriskbx\gtt\Output;
55

6-
76
use Illuminate\Support\Collection;
87
use kriskbx\gtt\Issue;
9-
use kriskbx\gtt\Time;
108
use League\Csv\Writer;
119
use SplTempFileObject;
12-
use Symfony\Component\Console\Helper\QuestionHelper;
13-
use Symfony\Component\Console\Input\InputInterface;
14-
use Symfony\Component\Console\Output\OutputInterface;
1510

1611
class CsvOutput extends AbstractOutput
1712
{

src/Output/MarkdownOutput.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ protected function cleanUp()
6666
*/
6767
protected function total()
6868
{
69-
$subString = "* **Total:** " . Time::humanReadable($this->totalTime) . "\n";
69+
$subString = "* **Total spent:** " . Time::humanReadable($this->totalTime) . "\n";
70+
$subString .= "* **Total estimated:** " . Time::humanReadable($this->totalEstimate) . "\n";
7071

7172
collect($this->totalTimeByUser)->each(function ($time, $user) use (&$subString) {
7273
$subString .= "* **{$user}:** " . Time::humanReadable($time) . "\n";

src/Output/TableOutput.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function render(Collection $issues, $title, array $params)
6262
// WE NEED SPACES
6363
$this->output->writeln('');
6464
$this->output->writeln('');
65-
$this->output->writeln($title);
65+
$this->output->writeln("<fg=black;bg=blue> {$title} </>");
6666
$this->output->writeln('');
6767

6868
$this->total();
@@ -126,7 +126,8 @@ protected function estimationBar(Estimation $estimation, $params = [])
126126
*/
127127
protected function total()
128128
{
129-
$string = "* <fg=blue>Total:</> " . Time::humanReadable($this->totalTime) . "\n";
129+
$string = "* <fg=blue>Total spent:</> " . Time::humanReadable($this->totalTime) . "\n";
130+
$string .= "* <fg=blue>Total estimate:</> " . Time::humanReadable($this->totalEstimate) . "\n\n";
130131

131132
collect($this->totalTimeByUser)->each(function ($time, $user) use (&$string) {
132133
$string .= "* <fg=blue>{$user}:</> " . Time::humanReadable($time) . "\n";

src/Time/HasTimes.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
namespace kriskbx\gtt\Time;
44

55
use Carbon\Carbon;
6+
use Illuminate\Support\Collection;
67
use kriskbx\gtt\Collection\TimesCollection;
8+
use kriskbx\gtt\Estimation;
79
use kriskbx\gtt\Time;
810

911
trait HasTimes

0 commit comments

Comments
 (0)