예제 #1
0
    def Formula_PerformanceComparedToAllReleases(row_index,
                                                 col_index,
                                                 bundle_count,
                                                 config_count,
                                                 MD=True):
        # bundle_count = 4
        # row_index = 3
        # col_index = 14
        # config_count = 4

        Constant_range_cell = Utils.get_cell_range(row_index, col_index,
                                                   bundle_count, MD)
        formula_list = []

        row = row_index
        for j in range(config_count):
            row_index = row + j
            col_name = Utils.GetColumnName(col_index)
            current_cell = col_name + str(row_index)  # O3
            range_cell = Utils.get_cell_range(row_index, col_index,
                                              bundle_count)
            # print "current_cell",current_cell
            # print "range_cell",range_cell
            str_ = "="
            extra_bracket = 0
            if MD:
                str_ += 'IF(COUNT({0})=0,"NEW",'.format(Constant_range_cell)
                extra_bracket = 1
            next_cell = Utils.GetColumnName(col_index + 1) + str(row_index)
            str_ += 'IF({0}="NA","NA",IF({1}="NA","NA",'.format(
                current_cell, next_cell)
            # print "row_index",row_index

            if bundle_count <= 2:
                temp_str = Formulas.condition(row_index, col_index,
                                              bundle_count)
                for i in range(bundle_count + extra_bracket):
                    temp_str += ")"
                str_ += temp_str
            else:
                next_cell = ""
                for i in range(2, bundle_count):
                    next_cell = Utils.GetColumnName(col_index +
                                                    i) + str(row_index)
                    if i > 2:
                        str_ += ","
                    str_ += 'IF({}="NA",'.format(next_cell)
                    str_ += Formulas.condition(row_index, col_index, i)

                    temp_str = "," + Formulas.condition(
                        row_index, col_index, bundle_count)
                # print temp_str
                for i in range(bundle_count + extra_bracket):
                    temp_str += ")"
                str_ += temp_str
            formula_list.append(str_)

        return formula_list
예제 #2
0
 def Formula_Average(row_index, col_index, current_col_index, bundle_count,
                     config_count, test_count):
     NA_Cell = "A" + str(Constants.NA_ROW_INDEX_REFERENCE)
     string = '=IFERROR(AVERAGE('
     for i in range(test_count):
         cell_range = Utils.get_cell_range(row_index, col_index - 1,
                                           bundle_count + 1)
         current_cell = Utils.GetColumnName(current_col_index) + str(
             row_index)
         string += 'IF(COUNT({0})={1},{2},{3}),'.format(
             cell_range, bundle_count, current_cell, NA_Cell)
         row_index += config_count
     return string[:-1] + '),"NA")'
예제 #3
0
 def condition(row_index, col_index, bundle_count):
     range_cell = Utils.get_cell_range(row_index, col_index, bundle_count)
     current_cell = Utils.GetColumnName(col_index) + str(row_index)
     sstr = 'IF((MIN({1})-0.1*(MIN({1})))<={0},(IF({0}<=(MIN({1})+0.1*(MIN({1}))),"Similar",(IF({0}>(MIN({1})),"Degraded","Improved")))),"Improved")'
     condition_ = sstr.format(current_cell, range_cell)
     return condition_
예제 #4
0
 def Formula_ImprovementPercentageComparedToCurrentRelease(
         row_index, col_index):
     current_cell = Utils.GetColumnName(col_index) + str(row_index)
     next_cell = Utils.GetColumnName(col_index + 1) + str(row_index)
     return '=IFERROR(IF({0}="NA","NA",IF({1}="NA","NA",(({1}-{0})/{1}))),"NA")'.format(
         current_cell, next_cell)
예제 #5
0
 def Formula_PerformanceComparedToLastRelease(row_index, col_index):
     current_cell = Utils.GetColumnName(col_index) + str(row_index)
     next_cell = Utils.GetColumnName(col_index + 1) + str(row_index)
     return '=IF(COUNTIF({0}:{1},"NA"),"NA",IF({0}-0.1*{0}<{1},"Improved",IF({0}+0.1*{0}>{1},"Degraded","Similar")))'.format(
         current_cell, next_cell)