Advertisement
Guest User

Untitled

a guest
Dec 11th, 2014
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.       $scope.GetFolderPath = function (fieldReport, fieldHeader) {
  2.                 var RatingCount = 5;
  3.                 var ImgPath = "";
  4.                 $sd = fieldHeader.QUESTIONName;
  5.                 var QName = fieldReport[$sd];
  6.                 var strSplit = QName.split(':');
  7.                 var QId = strSplit[0];
  8.                 var Result = strSplit[1];
  9.                 var SA = strSplit[2];
  10.  
  11.                 if (SA == "true" || SA == "1" || SA == "True") {
  12.                     $scope.SS_CS_FolderName = $scope.Temp_SS_CS_FolderName;
  13.                     $scope.PR_FolderName = $scope.Temp_PR_FolderName;
  14.                     $scope.isSystemStarted = true;
  15.                 }
  16.                 else {
  17.                     $scope.SS_CS_FolderName = $scope.Temp_SS_CS_FolderName;
  18.                     $scope.PR_FolderName = $scope.Temp_PR_FolderName;
  19.                     $scope.isManualStarted = true;
  20.                 }
  21.                 if (Result == "") {
  22.                     ImgPath = "RI/SS_CS/5/" + $scope.SS_CS_FolderName + "/NA.png";
  23.                 }
  24.                 else {
  25.                     try {
  26.                         var lll = parseFloat(Result);
  27.                         var CoreResult = parseFloat(Result);
  28.                         if (CoreResult <= 0) {
  29.                             if ($scope.isQuestionSelected) {
  30.                                 ImgPath = "RI/SS_CS/" + RatingCount + "/" + SS_CS_FolderName + "/NA_selected.png";
  31.                             }
  32.                             else {
  33.                                 ImgPath = "RI/SS_CS/5/" + $scope.SS_CS_FolderName + "/NA.png";
  34.                             }
  35.                         }
  36.                         if (CoreResult > 0 && CoreResult <= 1) {
  37.                             if ($scope.isQuestionSelected) {
  38.                                 ImgPath = "RI/SS_CS/" + RatingCount + "/" + $scope.SS_CS_FolderName + "/1_selected.png";
  39.                             }
  40.                             else {
  41.                                 ImgPath = "RI/SS_CS/5/" + $scope.SS_CS_FolderName + "/1.png";
  42.                             }
  43.                         }
  44.                         if (CoreResult > 1 && CoreResult <= 2) {
  45.                             if ($scope.isQuestionSelected) {
  46.                                 ImgPath = "RI/SS_CS/" + RatingCount + "/" + $scope.SS_CS_FolderName + "/2_selected.png";
  47.                             }
  48.                             else {
  49.                                 ImgPath = "RI/SS_CS/5/" + $scope.SS_CS_FolderName + "/2.png";
  50.                             }
  51.                         }
  52.                         if (CoreResult > 2 && CoreResult <= 3) {
  53.                             if ($scope.isQuestionSelected) {
  54.                                 ImgPath = "RI/SS_CS/" + RatingCount + "/" + $scope.SS_CS_FolderName + "/3_selected.png";
  55.                             }
  56.                             else {
  57.                                 ImgPath = "RI/SS_CS/5/" + $scope.SS_CS_FolderName + "/3.png";
  58.                             }
  59.                         }
  60.                         if (CoreResult > 3 && CoreResult <= 4) {
  61.                             if ($scope.isQuestionSelected) {
  62.                                 img.ImageUrl = "RI/SS_CS/" + RatingCount + "/" + $scope.SS_CS_FolderName + "/4_selected.png";
  63.                             }
  64.                             else {
  65.                                 ImgPath = "RI/SS_CS/5/" + $scope.SS_CS_FolderName + "/4.png";
  66.                             }
  67.                         }
  68.                         if (CoreResult > 4 && CoreResult <= 5) {
  69.                             if ($scope.isQuestionSelected) {
  70.                                 ImgPath = "RI/SS_CS/" + RatingCount + "/" + $scope.SS_CS_FolderName + "/5_selected.png";
  71.                             }
  72.                             else {
  73.                                 ImgPath = "RI/SS_CS/5/" + $scope.SS_CS_FolderName + "/5.png";
  74.                             }
  75.                         }
  76.                         if (CoreResult > 5 && CoreResult <= 6) {
  77.                             if ($scope.isQuestionSelected) {
  78.                                 ImgPath = "RI/SS_CS/" + RatingCount + "/" + $scope.SS_CS_FolderName + "/6_selected.png";
  79.                             }
  80.                             else {
  81.                                 ImgPath = "RI/SS_CS/5/" + $scope.SS_CS_FolderName + "/6.png";
  82.                             }
  83.                         }
  84.                         if (CoreResult > 6 && CoreResult <= 7) {
  85.                             if ($scope.isQuestionSelected) {
  86.                                 ImgPath = "RI/SS_CS/" + RatingCount + "/" + $scope.SS_CS_FolderName + "/7_selected.png";
  87.                             }
  88.                             else {
  89.                                 ImgPath = "RI/SS_CS/5/" + $scope.SS_CS_FolderName + "/7.png";
  90.                             }
  91.                         }
  92.                         if (Result == "Y") {
  93.                             if ($scope.isQuestionSelected) {
  94.                                 ImgPath = "RI/PR/" + $scope.PR_FolderName + "/Right_selected.png";
  95.                             }
  96.                             else {
  97.                                 ImgPath = "RI/PR/" + $scope.PR_FolderName + "/Right.png";
  98.                             }
  99.                         }
  100.                         if (Result == "N") {
  101.                             if ($scope.isQuestionSelected) {
  102.                                 ImgPath = "RI/PR/" + $scope.PR_FolderName + "/Wrong_selected.png";
  103.                             }
  104.                             else {
  105.                                 ImgPath = "RI/PR/" + $scope.PR_FolderName + "/Wrong.png";
  106.                             }
  107.                         }
  108.                         if (Result == "NA") {
  109.                             if ($scope.isQuestionSelected) {
  110.                                 ImgPath = "RI/PR/" + $scope.PR_FolderName + "/NA_selected.png";
  111.                             }
  112.                             else {
  113.                                 ImgPath = "RI/PR/" + $scope.PR_FolderName + "/NA.png";
  114.                             }
  115.                         }
  116.                         if (Result == "SNA") {
  117.                             if ($scope.isQuestionSelected) {
  118.                                 ImgPath = "RI/NotAssessed_selected.png";
  119.                             }
  120.                             else {
  121.                                 ImgPath = "RI/NotAssessed.png";
  122.                             }
  123.                         }
  124.                     }
  125.                     catch (error) {
  126.                         if (Result == "Y") {
  127.                             ImgPath = "RI/PR/" + $scope.PR_FolderName + "/Right.png";
  128.                         }
  129.                         if (Result == "N") {
  130.                             ImgPath = "RI/PR/" + $scope.PR_FolderName + "/Wrong.png";
  131.                         }
  132.                         if (Result == "NA") {
  133.                             ImgPath = "RI/PR/" + $scope.PR_FolderName + "/NA.png";
  134.                         }
  135.                         if (Result == "SNA") {
  136.                             ImgPath = "RI/NotAssessed.png";
  137.                         }
  138.                     }
  139.                 }
  140.                 return ImgPath;
  141.             }
  142.             $scope.GetOverallPath = function (field) {
  143.                 var ImgPath = "";
  144.                 var Rating = parseFloat(field.Overall);
  145.                 var RatingCount = "5";
  146.                 if (Rating == -1) {
  147.                     ImgPath = "RI/Overall/" + RatingCount + "/" + $scope.Overall_FolderName + "/0.0.png";
  148.                 }
  149.                 if (Rating >= 0 && Rating <= 0.24) {
  150.                     ImgPath = "RI/Overall/" + RatingCount + "/" + $scope.Overall_FolderName + "/0.0.png";
  151.                 }
  152.                 if (Rating > 0.24 && Rating <= 0.74) {
  153.                     ImgPath = "RI/Overall/" + RatingCount + "/" + $scope.Overall_FolderName + "/0.5.png";
  154.                 }
  155.                 if (Rating > 0.74 && Rating <= 1.24) {
  156.                     ImgPath = "RI/Overall/" + RatingCount + "/" + $scope.Overall_FolderName + "/1.0.png";
  157.                 }
  158.                 if (Rating > 1.24 && Rating <= 1.74) {
  159.                     ImgPath = "RI/Overall/" + RatingCount + "/" + $scope.Overall_FolderName + "/1.5.png";
  160.                 }
  161.                 if (Rating > 1.74 && Rating <= 2.24) {
  162.                     ImgPath = "RI/Overall/" + RatingCount + "/" + $scope.Overall_FolderName + "/2.0.png";
  163.                 }
  164.                 if (Rating > 2.24 && Rating <= 2.74) {
  165.                     ImgPath = "RI/Overall/" + RatingCount + "/" + $scope.Overall_FolderName + "/2.5.png";
  166.                 }
  167.                 if (Rating > 2.74 && Rating <= 3.24) {
  168.                     ImgPath = "RI/Overall/" + RatingCount + "/" + $scope.Overall_FolderName + "/3.0.png";
  169.                 }
  170.                 if (Rating > 3.24 && Rating <= 3.74) {
  171.                     ImgPath = "RI/Overall/" + RatingCount + "/" + $scope.Overall_FolderName + "/3.5.png";
  172.                 }
  173.                 if (Rating > 3.74 && Rating <= 4.24) {
  174.                     ImgPath = "RI/Overall/" + RatingCount + "/" + $scope.Overall_FolderName + "/4.0.png";
  175.                 }
  176.                 if (Rating > 4.24 && Rating <= 4.74) {
  177.                     ImgPath = "RI/Overall/" + RatingCount + "/" + $scope.Overall_FolderName + "/4.5.png";
  178.                 }
  179.                 if (Rating > 4.74 && Rating <= 5.24) {
  180.                     ImgPath = "RI/Overall/" + RatingCount + "/" + $scope.Overall_FolderName + "/5.0.png";
  181.                 }
  182.                 if (Rating > 5.24 && Rating <= 5.74) {
  183.                     ImgPath = "RI/Overall/" + RatingCount + "/" + $scope.Overall_FolderName + "/5.5.png";
  184.                 }
  185.                 if (Rating > 5.74 && Rating <= 6.24) {
  186.                     ImgPath = "RI/Overall/" + RatingCount + "/" + $scope.Overall_FolderName + "/6.0.png";
  187.                 }
  188.                 return ImgPath;
  189.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement