Add to sub commonTagsHandler # %XPSHOWITERATIONBYDEVELOPER% - Show stories by developer $_[0] =~ s/%XPSHOWITERATIONBYDEVELOPER\{(.*?)\}%/&xpShowIterationByDeveloper($1,$web)/geo; # %XPSHOWITERATIONTERSEBYDEVELOPER% - Show stories by developer $_[0] =~ s/%XPSHOWITERATIONTERSEBYDEVELOPER\{(.*?)\}%/&xpShowIterationTerseByDeveloper($1,$web)/geo; And to new functions ########################### # xpShowIterationByDeveloper # # Shows the specified iteration broken down by stories and tasks for developer sub xpShowIterationByDeveloper { my ($arguments,$web) = @_; my ($iterationName,$developerName) = split(/,/,$arguments); my @statusLiterals = ("Not Started", "In progress", "Complete", "Acceptance"); my $list = "

Details for $developerName in $iterationName iteration

"; $list .= ""; $list .= ""; my @allStories = &xpGetIterStories($iterationName, $web); # Iterate over each story and add to hash my (%targetStories,%targetOrder) = (); foreach my $story (@allStories) { my $storyText = &TWiki::Store::readTopic($web, $story); $targetStories{$story} = $storyText; # Get the ordering and save it $targetOrder{$story} = &xpGetValue("\\*Development order\\*", $storyText, "order"); } my ($totalSpent,$totalEtc,$totalEst) = 0; # Show them foreach my $story (sort { $targetOrder{$a} <=> $targetOrder{$b} || $a cmp $b } keys %targetStories) { my $storyText = $targetStories{$story}; # Get acceptance test status my $storyComplete = "N"; my $ret = &xpGetValue("\\*Passed acceptance test\\*", $storyText, "complete"); $storyComplete = uc(substr($ret,0,1)); # Get story lead my $storyLead = &xpGetValue("\\*Story Lead\\*", $storyText, "storyLead"); # Set up other story stats my ($storySpent,$storyEtc,$storyCalcEst) = 0; # Suck in the tasks my (@taskName, @taskStat, @taskEst, @taskWho, @taskSpent, @taskEtc) = (); # arrays for each task my $taskCount = 0; # Amount of tasks in this story my @storyStat = (0,0,0); # Array of counts of task status $countThis="NO"; while(1) { (my $status,my $name,my $est,my $who,my $spent,my $etc,my $tstatus) = xpGetNextTask($storyText); if (!$status) { last; } $taskActive[$taskCount]="NO"; # for each engineer (in case of pair programmer) # in this case est, spent, etc should have the same numbers my @pairWho=split(/\s+/,$who); my @pairEst=split(/\s+/,$est); my @pairSpent=split(/\s+/,$spent); my @pairEtc=split(/\s+/,$etc); for ($i=0; $i<=$#pairWho; $i++) { if ( $pairWho[$i] eq $developerName ) { $countThis="YES"; $taskName[$taskCount] = $name; $taskWho[$taskCount] = $pairWho[$i]; if ($i > $#pairEst) { $taskEst[$taskCount] = $pairEst[0]; } else { $taskEst[$taskCount] = $pairEst[$i]; } if ($i > $#pairSpent) { $taskSpent[$taskCount] = $pairSpent[0]; } else { $taskSpent[$taskCount] = $pairSpent[$i]; } print STDERR "ETC:$i $#pairSpent"; if ($i > $#pairEtc) { $taskEtc[$taskCount] = $pairEtc[0]; } else { $taskEtc[$taskCount] = $pairEtc[$i]; } $taskStat[$taskCount] = $tstatus; $storyStat[$taskStat[$taskCount]]++; # Calculate spent my @spentList = xpRipWords($taskSpent[$taskCount]); foreach my $spent (@spentList) { $storySpent += $spent; } # Calculate etc my @etcList = xpRipWords($taskEtc[$taskCount]); foreach my $etc (@etcList) { $storyEtc += $etc; } # Calculate est my @estList = xpRipWords($taskEst[$taskCount]); foreach my $etc (@estList) { $storyCalcEst += $etc; } $taskCount++; } } } if ( $countThis eq "NO" ) { next; } # Calculate story status my $color = ""; my $storyStatS = ""; if ( ($storyStat[1] == 0) and ($storyStat[2] == 0) ) { # All tasks are unstarted $color = "#FFCCCC"; $storyStatS = $statusLiterals[0]; } elsif ( ($storyStat[0] == 0) and ($storyStat[1] == 0) ) { # All tasks complete if ($storyComplete eq "Y") { $storyStatS = $statusLiterals[2]; } else { $color = "#ccffff"; $storyStatS = $statusLiterals[3]; } } else { $color = "#99FF99"; $storyStatS = $statusLiterals[1]; } # Show story line $list .= ""; # Show each task for (my $i=0; $i<$taskCount; $i++) { my $taskBG = ""; if ($taskStat[$i] == 0) { $taskBG = " bgcolor=\"#FFCCCC\""; } elsif ($taskStat[$i] == 1) { $taskBG = " bgcolor=\"#99FF99\""; } # Line for each engineer my $doName = 1; my @who = xpRipWords($taskWho[$i]); my @est = xpRipWords($taskEst[$i]); my @spent = xpRipWords($taskSpent[$i]); my @etc = xpRipWords($taskEtc[$i]); for (my $x=0; $x<@who; $x++) { if ( $who[$x] ne $developerName ) { next; } $list .= ""; $doName = 0; } } # Add a spacer $list .= ""; # Add to totals $totalSpent += $storySpent; $totalEtc += $storyEtc; $totalEst += $storyCalcEst; } # Do iteration totals $list .= ""; $list .= "
Story
  Tasks
EstimateWhoSpentTo doStatus
".$storyCalcEst." ".$storyLead." ".$storySpent.""; $list .= "".$storyEtc.""; $list .= "".$storyStatS."
 "; if ($doName) { $list .= "   ".$taskName[$i]; } $list .= "".$est[$x]." ".$who[$x]." ".$spent[$x]."".$etc[$x].""; $list .= $statusLiterals[$taskStat[$i]]; $list .= "
 
Developer totals".$totalEst."".$totalSpent."".$totalEtc."
"; return $list; } ########################### # xpShowIterationTerseByDeveloper # # Shows the specified iteration broken down by stories for developer # Copied from XpShowIterationByDeveloper. Need to refactor! sub xpShowIterationTerseByDeveloper { my ($arguments,$web) = @_; my ($iterationName,$developerName) = split(/,/,$arguments); my $showTasks = "N"; my @statusLiterals = ("Not Started", "In progress", "Complete", "Acceptance"); my $list = "

Stories for $developerName in $iterationName iteration

"; $list .= ""; $list .= ""; my @allStories = &xpGetIterStories($iterationName, $web); # Iterate over each story and add to hash my (%targetStories,%targetOrder) = (); foreach my $story (@allStories) { my $storyText = &TWiki::Store::readTopic($web, $story); $targetStories{$story} = $storyText; # Get the ordering and save it $targetOrder{$story} = &xpGetValue("\\*Development order\\*", $storyText, "order"); } my ($totalSpent,$totalEtc,$totalEst) = 0; # Show them foreach my $story (sort { $targetOrder{$a} <=> $targetOrder{$b} || $a cmp $b } keys %targetStories) { my $storyText = $targetStories{$story}; # Get PTS my $fea = &xpGetValue("\\*PTS\\*", $storyText, "notagsforthis"); # Get story summary my $storySummary = &xpGetValue("\\*Story summary\\*", $storyText, "notagsforthis"); # Get acceptance test status my $storyComplete = "N"; my $ret = &xpGetValue("\\*Passed acceptance test\\*", $storyText, "complete"); if($ret) { $storyComplete = uc(substr($ret,0,1)); } # Set up other story stats my ($storySpent,$storyEtc,$storyCalcEst) = 0; # still need to parse tasks to track total time estimates # Suck in the tasks. Move this code into separate routine my (@taskName, @taskStat, @taskEst, @taskWho, @taskSpent, @taskEtc) = (); # arrays for each task my $taskCount = 0; # Amount of tasks in this story my @storyStat = (0,0,0); # Array of counts of task status my $storyStatS = ''; $countThis="NO"; while(1) { (my $status,my $name,my $est,my $who,my $spent,my $etc,my $tstatus) = xpGetNextTask($storyText); if (!$status) { last; } # for each engineer my @pairWho=split(/\s+/,$who); my @pairEst=split(/\s+/,$est); my @pairSpent=split(/\s+/,$spent); my @pairEtc=split(/\s+/,$etc); # print STDERR "AAA:$etc"; for ($i=0; $i<=$#pairWho; $i++) { if ( $pairWho[$i] eq $developerName ) { if ($i > $#pairEst) { $taskEst[$taskCount] = $pairEst[0]; } else { $taskEst[$taskCount] = $pairEst[$i]; } if ($i > $#pairSpent) { $taskSpent[$taskCount] = $pairSpent[0]; } else { $taskSpent[$taskCount] = $pairSpent[$i]; } if ($i > $#pairEtc) { $taskEtc[$taskCount] = $pairEtc[0]; } else { $taskEtc[$taskCount] = $pairEtc[$i]; } $countThis="YES"; $taskName[$taskCount] = $name; $taskWho[$taskCount] = $pairWho[$i]; $taskStat[$taskCount] = $tstatus; $storyStat[$taskStat[$taskCount]]++; # Calculate spent my @spentList = xpRipWords($taskSpent[$taskCount]); foreach my $spent (@spentList) { $storySpent += $spent; } # Calculate etc my @etcList = xpRipWords($taskEtc[$taskCount]); foreach my $etc (@etcList) { $storyEtc += $etc; } # Calculate est my @estList = xpRipWords($taskEst[$taskCount]); foreach my $etc (@estList) { $storyCalcEst += $etc; } $taskCount++; } } } if ( $countThis eq "NO" ) { next; } # Calculate story status if ( ($storyStat[1] == 0) and ($storyStat[2] == 0) ) { # All tasks are unstarted # status: not started $color = "#FFCCCC"; $storyStatS = $statusLiterals[0]; } elsif ( ($storyStat[0] == 0) and ($storyStat[1] == 0) ) { # All tasks complete if ($storyComplete eq "Y") { # status: complete $storyStatS = $statusLiterals[2]; } else { # status: acceptance $color = "#ccffff"; $storyStatS = $statusLiterals[3]; } } else { # status: in progress $color = "#99FF99"; $storyStatS = $statusLiterals[1]; } # Show story line $list .= " ".$storySummary." \n"; $list .= "\n"; $list .= "\n"; $list .= "\n"; $list .= ""; my $done = 0; if(($storySpent + $storyEtc) > 0) { $done = int(100.0 * $storySpent / ($storySpent + $storyEtc)); } $list .= ""; $list .= ""; my $cfEst = 0; if($storyCalcEst > 0) { $cfEst = int(100*(($storySpent + $storyEtc) / $storyCalcEst) - 100); } if($cfEst >= 0) { $list .= ""; } else { $list .= ""; } $list .= ""; $list .= ""; # Show each task if($showTasks eq "Y") { for (my $i=0; $i<$taskCount; $i++) { my $taskBG = ""; if ($taskStat[$i] != 2) { $taskBG = " bgcolor=\"#FFCCCC\""; } # Line for each engineer my $doName = 1; my @who = xpRipWords($taskWho[$i]); my @est = xpRipWords($taskEst[$i]); my @spent = xpRipWords($taskSpent[$i]); my @etc = xpRipWords($taskEtc[$i]); for (my $x=0; $x<@who; $x++) { $list .= ""; $doName = 0; } } # Add a spacer if showing tasks $list .= ""; } # Add to totals $totalSpent += $storySpent; $totalEtc += $storyEtc; $totalEst += $storyCalcEst; } # Do iteration totals $list .= ""; # refactor this code! (mwatt) my $totDone = 0; if(($totalSpent + $totalEtc) > 0) { $totDone = int(100.0 * $totalSpent / ($totalSpent + $totalEtc)); } my $totLeft = (100 - $totDone); my $gaugeTxt = gaugeLite($totDone); $list .= ""; $list .= ""; my $cfTotEst = 0; if($totalEst > 0) { $cfTotEst = int(100*(($totalSpent + $totalEtc) / $totalEst) - 100); } if($cfTotEst >= 0) { $list .= ""; } else { $list .= ""; } $list .= "\n"; $list .= "
StoryPTSEstimateSpentToDoProgressDoneOverrunCompletion
".$fea." ".$storyCalcEst."".$storySpent."".$storyEtc.""; $list .= gaugeLite($done); $list .= "".$done."% +".$cfEst."%".$cfEst."%".$storyStatS."
 "; if ($doName) { $list .= "   ".$taskName[$i]; } $list .= "".$est[$x]." ".$who[$x]." ".$spent[$x]."".$etc[$x].""; $list .= $statusLiterals[$taskStat[$i]]; $list .= "
 
Developer totals".$totalEst."".$totalSpent."".$totalEtc.""; $list .= $gaugeTxt; $list .= "".$totDone."% +".$cfTotEst."% ".$cfTotEst."%
\n"; # dump summary information into a comment for extraction by xpShowTeamIterations $list .= "\n"; # append "create new story" form # $list .= &xpCreateHtmlForm("NewnameStory", "StoryTemplate", "Create new story in this iteration"); return $list; }