예제 #1
0
 def reqList2ndLevel(self):
     """List of Content objects"""
     evaluations1stLevelTodo = self.context.getEvaluationsTodo()
     evaluations1stLevelDone = self.context.getEvaluationsDone()
     attrs = self.context.getRefAttributeNames()
     if 'requirements' in attrs:
         attrs.remove('requirements')
     if 'categories' in attrs:
         attrs.remove('categories')
     retList = []
     for attr in attrs:
         objs = getattr(self.context, attr)
         if type(objs) is not list:
             objs = [objs]
         for obj in objs:
             if hasattr(obj, "requirements"):
                 evaluations = getEvaluationsTodo(obj)
                 #evaluations = self.context.getEvaluationsTodo()
                 for ev in evaluations:
                     alreadyDoneIn1stLevel = \
                         ev in [evaluation.requirement
                                for evaluation in evaluations1stLevelDone]
                     alreadyTodoIn1stLevel = \
                         ev in [evaluation.requirement
                                for evaluation in evaluations1stLevelTodo]
                     if not alreadyDoneIn1stLevel and \
                         not alreadyTodoIn1stLevel:
                         retList.append({"req": ev, "obj": self.context})
     return retList
예제 #2
0
 def allReqsList(self):
     """List of Content objects"""
     retList = []
     objList = objectsWithInterface(IComponent)
     for obj in objList:
         evaluations = getEvaluationsTodo(obj)
         for ev in evaluations:
             retList.append({"req": ev, "obj": obj})
     return retList
예제 #3
0
 def resumee(self):
     allObjEvaluations = getEvaluationsDone(self.context)
     reqs = allObjEvaluations.items()
     reqs_ok = 0
     reqs_fail = 0
     for req_tupel in reqs:
         if req_tupel[1].value == "Pass":
             reqs_ok += 1
         elif req_tupel[1].value == "Fail":
             reqs_fail += 1
     reqs_todo = len(getEvaluationsTodo(self.context))
     return (reqs_todo, reqs_ok, reqs_fail)
예제 #4
0
 def objs(self):
     #import pdb
     #pdb.set_trace()
     retList = []
     uidutil = getUtility(IIntIds)
     for (myid, myobj) in uidutil.items():
         if IComponent.providedBy(myobj.object):
             base_reqs = getEvaluationsTodo(myobj.object)
             for req in base_reqs:
                 retList.append({'obj': req, 'component': myobj.object})
                 #retList.append((req, myobj.object))
     return retList
예제 #5
0
def appendEvaluationList(obj, document):
    elemList = []
    if hasattr(obj, 'requirement') \
       and obj.requirement is not None:
        my_catalog = zapi.getUtility(ICatalog)
        res = my_catalog.searchResults(oid_index=obj.requirement)
        if len(res) > 0:
            requirementObj = iter(res).next()
            reqTitle = requirementObj.ikName
            reqComment = requirementObj.ikComment
            elemList.append(RptPara(reqTitle,
                                    doc=document))
            elemList.append(RptPara(reqComment,
                                    doc=document))
            elemList.append(Spacer(0, 4 * mm))
    # Evaluations Done
    evaluations = getEvaluationsDone(obj)
    if len(evaluations) > 0:
        styleSheet = getRptStyleSheet()
        style1 = styleSheet['Small']
        style2 = styleSheet['Infobox']
        elemList.append(
            RptPara('Evaluations Done: ', style=style2, doc=document))
        colWidths = [15 * mm, 60 * mm, 20 * mm, 40 * mm]
        data = [[
            RptPara('<b>Pos</b>', style=style1, doc=document),
            RptPara('<b>Requirement</b>', style=style1, doc=document),
            RptPara('<b>Value</b>', style=style1, doc=document),
            RptPara('<b>Evaluator</b>', style=style1, doc=document)
        ]]
        rowColor = getTabBackgroundColor()
        rowColorLight = getTabBackgroundColorLight()
        ik_tbl_style = TableStyle([\
            ('BACKGROUND', (0, 0), (-1, 0), rowColor),
            ('LEFTPADDING', (0, 0), (-1, -1), 1 * mm),
            ('RIGHTPADDING', (0, 0), (-1, -1), 1 * mm),
            ('BOTTOMPADDING', (0, 0), (-1, -1), 1 * mm),
            ('TOPPADDING', (0, 0), (-1, -1), 2 * mm),
            ('FONTSIZE', (0, 0), (-1, -1), 8),
            ('ALIGN', (0, 0), (-1, -1), 'LEFT'),
            ('ROWBACKGROUNDS',(0,0),(-1,-1),[rowColor, rowColorLight]),
            ('INNERGRID', (0, 0), (-1, -1), 0.25, colors.black),
            ('BOX', (0, 0), (-1, -1), 0.25, colors.black),
        ])
        pos = 0
        for evaluation in evaluations.values():
            pos = pos + 1
            if evaluation.value == 'Pass':
                ik_tbl_style.add('BACKGROUND', (2, pos), (2, pos), colors.green)
            elif evaluation.value == 'Fail':
                ik_tbl_style.add('BACKGROUND', (2, pos), (2, pos), colors.red)
            else:
                pass
            if len(evaluation.requirement) == 0:
                data.append([
                    RptPara(evaluation.requirement.getIndexString(),
                            style=style1,
                            doc=document),
                    RptPara(evaluation.requirement.ikName,
                            style=style1,
                            doc=document),
                    RptPara(evaluation.value,
                            style=style1, 
                            doc=document),
                    RptPara(evaluation.evaluator.title,
                            style=style1, 
                            doc=document),
                ])
        t0 = Table(data,
                   hAlign='RIGHT',
                   style=ik_tbl_style,
                   colWidths=colWidths)
        elemList.append(t0)
        elemList.append(Spacer(0, 3 * mm))
    # Evaluations ToDo
    evaluations = getEvaluationsTodo(obj)
    if len(evaluations) > 0:
        styleSheet = getRptStyleSheet()
        style1 = styleSheet['Small']
        style2 = styleSheet['Infobox']
        elemList.append(
            RptPara('Evaluations ToDo: ', style=style2, doc=document))
        #colWidths = [75 * mm, 20 * mm, 40 * mm]
        colWidths = [15 * mm, 120 * mm]
        data = [[
            RptPara('<b>Pos</b>', style=style1, doc=document),
            RptPara('<b>Requirement</b>', style=style1, doc=document),
            #RptPara('<b>Value</b>', style=style1, doc=document),
            #RptPara('<b>Evaluator</b>', style=style1, doc=document)
        ]]
        rowColor = getTabBackgroundColor()
        rowColorLight = getTabBackgroundColorLight()
        ik_tbl_style = TableStyle([\
            ('BACKGROUND', (0, 0), (-1, 0), rowColor),
            ('LEFTPADDING', (0, 0), (-1, -1), 1 * mm),
            ('RIGHTPADDING', (0, 0), (-1, -1), 1 * mm),
            ('BOTTOMPADDING', (0, 0), (-1, -1), 1 * mm),
            ('TOPPADDING', (0, 0), (-1, -1), 2 * mm),
            ('FONTSIZE', (0, 0), (-1, -1), 8),
            ('ALIGN', (0, 0), (-1, -1), 'LEFT'),
            ('ROWBACKGROUNDS',(0,0),(-1,-1),[rowColor, rowColorLight]),
            ('INNERGRID', (0, 0), (-1, -1), 0.25, colors.black),
            ('BOX', (0, 0), (-1, -1), 0.25, colors.black),
        ])
        #pos = 0
        for evaluation in evaluations:
#            pos = pos + 1
#            if evaluation.value == 'Pass':
#                ik_tbl_style.add('BACKGROUND', (1, pos), (1, pos), colors.green)
#            elif evaluation.value == 'Fail':
#                ik_tbl_style.add('BACKGROUND', (1, pos), (1, pos), colors.red)
#            else:
#                pass
            if len(evaluation.keys()) == 0:
                data.append([
                    RptPara(evaluation.getIndexString(),
                            style=style1,
                            doc=document),
                    RptPara(evaluation.ikName,
                            style=style1,
                            doc=document),
#                RptPara(evaluation.value,
#                        style=style1, 
#                        doc=document),
#                RptPara(evaluation.evaluator.title,
#                        style=style1, 
#                        doc=document),
            ])
        t0 = Table(data,
                   hAlign='RIGHT',
                   style=ik_tbl_style,
                   colWidths=colWidths)
        elemList.append(t0)
        elemList.append(Spacer(0, 3 * mm))
    return elemList
예제 #6
0
 def getEvaluationsTodo(self):
     """ returns: [Requirement(u'ReqA1'), Requirement(u'ReqA2')]
     """
     return getEvaluationsTodo(self)