function updowndata($buildSearched, $component = null, $caseIDarg = null) { $version = getVersionFromBuild($buildSearched); // get up/down data for a build if ($component == null) { $arrData = createDataForUpDown($buildSearched); } elseif ($component != null) { $arrData = createDataForUpDownComponent($buildSearched, $component); } elseif ($caseID != null) { $arrData = createDataForUpDownCase($buildSearched, $caseIDarg); } if (!is_array($arrData)) { return "not_array"; } // extract searched build data $buildData = array(); foreach ($arrData as $release => $releaseData) { foreach ($releaseData[builds] as $buildNum => $build) { if ($buildNum == $buildSearched) { $buildData = $build; break; } } } // create results array $moduleArr = array(); foreach ($buildData[rel] as $versionFull => $release) { $relID = getVersionIDFromVersionFull($versionFull); if (!is_array($moduleArr[$relID][categories])) { $moduleArr[$relID][categories] = array(); } foreach ($release[cases] as $caseID => $case) { if (!is_array($moduleArr[$relID][categories][$case[category]])) { $moduleArr[$relID][categories][$case[category]] = array(); if (!is_array($moduleArr[$relID][categories][$case[category]][modules][$case[component]])) { $moduleArr[$relID][categories][$case[category]][modules][$case[component]] = array(); } } $moduleArr[$relID][categories][$case[category]][modules][$case[component]][cases][$caseID] = $case; } } foreach ($moduleArr as $relID => $rel) { $modNames = array(); $catNames = array(); $pass = $fail = $time = 0; foreach ($rel[categories] as $catName => $category) { array_push($catNames, "'" . $catName . "'"); $passC = $failC = $timeC = 0; foreach ($category[modules] as $modName => $module) { array_push($modNames, "'" . $modName . "'"); $passM = $failM = $timeM = 0; foreach ($module[cases] as $caseID => $case) { $timeC += $case[time]; $timeM += $case[time]; $time += $case[time]; if (!($case[time] > 0)) { $case[time] = 1; } $moduleArr[$relID][categories][$catName][modules][$modName][cases][$caseID][time] = date("i:s", mktime(0, 0, $case[time])); if ($case[status] == "PASSED") { $passM++; } elseif ($case[status] != "RUNNING") { $failM++; } } //email if ($failM == 0) { $moduleArr[$relID][categories][$catName][modules][$modName][email] = 0; } else { $moduleArr[$relID][categories][$catName][modules][$modName][email] = 1; } if ($gren == "grenreg") { $moduleArr[$relID][categories][$catName][modules][$modName][stats] = createTPFtableGren($passM, $failM, $version, $buildSearched, $modName, $catName, "yes"); $moduleArr[$relID][categories][$catName][modules][$modName][chart] = createBarChartForGrenReg($passM + $failM, $passM, $failM, $buildSearched, $version, $modName, $catName, "yes"); } else { $moduleArr[$relID][categories][$catName][modules][$modName][stats] = createTPFtableUpDown($relID, $passM, $failM, $version, $buildSearched, $modName, $catName, "yes"); $moduleArr[$relID][categories][$catName][modules][$modName][chart] = createBarChartForRegression2($passM + $failM, $passM, $failM, $buildSearched, $version, $modName, $catName, "yes"); } $moduleArr[$relID][categories][$catName][modules][$modName][time] = Sec2Time($timeM); $commentData = getModuleCommentsUpDown($modName, $catName, $buildSearched, $version, $relID); $ownerData = getModuleOwners($modName); $moduleArr[$relID][categories][$catName][modules][$modName][sqaOwner] = $ownerData[sqa]; $moduleArr[$relID][categories][$catName][modules][$modName][devOwner] = $ownerData[dev]; $moduleArr[$relID][categories][$catName][modules][$modName][autOwner] = $ownerData[auto]; if (is_array($commentData)) { $moduleArr[$relID][categories][$catName][modules][$modName][comment] = $commentData[comment]; $moduleArr[$relID][categories][$catName][modules][$modName][bugLink] = createModuleBugField($commentData[bugs]); $moduleArr[$relID][categories][$catName][modules][$modName][bugs] = $commentData[bugs]; } $passC += $passM; $failC += $failM; } $moduleArr[$relID][categories][$catName][stats] = createTPFtable2($passC, $failC, $version, $buildSearched, "", $catName, ""); $moduleArr[$relID][categories][$catName][chart] = createBarChartForRegression2($passC + $failC, $passC, $failC, $buildSearched, $version, $modName, $catName, ""); $moduleArr[$relID][categories][$catName][time] = Sec2Time($timeC); $pass += $passC; $fail += $failC; } $moduleArr[$relID][stats] = createTPFtable2($pass, $fail, $version, $buildSearched, "", "", ""); $moduleArr[$relID][chart] = createBarChartForRegression2($pass + $fail, $pass, $fail, $buildSearched, $version, $modName, $catName, ""); $moduleArr[$relID][time] = Sec2Time($time); $moduleArr[$relID][modNames] = implode(",", array_unique($modNames)); $moduleArr[$relID][catNames] = implode(",", array_unique($catNames)); $moduleArr[$relID][fullname] = getVersionFullFromVersionID($relID); } // sort category / component names in alphabetical order $relNames = array(); foreach ($moduleArr as $relID => $rel) { // store updown release names array_push($relNames, $relID); ksort($moduleArr[$relID][categories], SORT_STRING); foreach ($rel[categories] as $catName => $module) { ksort($rel[categories][$catName][modules], SORT_STRING); } } $result = array(); array_push($result, $moduleArr); array_push($result, implode(",", $relNames)); return $result; }
} //////////Baseline////////// if ($isBaselined) { foreach ($mapping_bk as $comp => $cat) { if ($extra[$cat]) { $moduleArr[categories][$cat][basetable] = createBasetable(0, $extra[$cat]); $catextra += $extra[$cat]; $extra[$cat] = 0; } $moduleArr[categories][$cat][modules][$comp][time] = '0 second'; $moduleArr[categories][$cat][modules][$comp][stats] = createTPFtable2(0, 0, $version, $build, $comp, $cat, "yes", "platform.php", $regr); $moduleArr[categories][$cat][modules][$comp][chart] = createBarChartForReg(1, 1, 0, $build, $version, $comp, $cat, 0, $regr, $gren, $rap); //$moduleArr[categories][$cat][modules][$comp][comment] ='Yet to Run in this build'; $moduleArr[categories][$cat][modules][$comp][basetable] = createBasetable(0, $baseValue[$comp]); $commentData = getModuleComments($comp, $cat, $build, $version, $regr); $ownerData = getModuleOwners($modName); $moduleArr[categories][$cat][modules][$comp][comment] = $commentData[comment]; $moduleArr[categories][$cat][modules][$comp][bugLink] = createModuleBugField($commentData[bugs]); $moduleArr[categories][$cat][modules][$comp][bugs] = $commentData[bugs]; $moduleArr[categories][$cat][modules][$comp][bugsOld] = $commentData[bugsOld]; $moduleArr[categories][$cat][modules][$comp][bugLinkOld] = createModuleBugField($commentData[bugsOld]); } $moduleArr[basetable] = createBasetable($pass + $fail, $baseVal + $catextra); } //////4. till here/////////////////// $moduleArr[stats] = createTPFtable2($pass, $fail, $version, $build, "", "", "", "platform.php"); $moduleArr[chart] = createBarChartForReg($pass + $fail, $pass, $fail, $build, $version, $modName, $catName, 0); $moduleArr[time] = Sec2Time($time); /////////////////////////////////////////////////// ########################################################################################################################### // sort category / component names in alphabetical order