Example #1
0
def personalBugDetails(request):
    results = []
    pName = request.GET['pName']
    status = request.GET['status']
    # 总计里的
    if pName == 'all':
        if status == 'TodayOpen':
            entrys = ReporterModel.objects.filter(CREATED__startswith = nowTime())
        elif status == 'TodayReOpen':
            entrys = ReporterModel.objects.filter(status = 'Reopened',UPDATED__startswith = nowTime())
        elif status == 'TodayClosed':
            entrys = ReporterModel.objects.filter(status = 'Closed',UPDATED__startswith = nowTime())
        elif status == 'CaseBug':
            entrys = ReporterModel.objects.filter(ASSIGNEE__in = peopleConfig('case_bug'))
        elif status == 'NoCaseBug':
            entrys = NoCaseBugModel.objects.filter()
        else:
            entrys = ReporterModel.objects.filter(status = status)
    else:
        if status == 'TodayOpen':
            entrys = ReporterModel.objects.filter(REPORTER = pName,CREATED__startswith = nowTime())
        elif status == 'TodayReOpen':
            entrys = ReporterModel.objects.filter(REPORTER = pName,status = 'Reopened',UPDATED__startswith = nowTime())
        elif status == 'TodayClosed':
            entrys = ReporterModel.objects.filter(REPORTER = pName,status = 'Closed',UPDATED__startswith = nowTime())
        elif status == 'CaseBug':
            entrys = ReporterModel.objects.filter(REPORTER = pName,ASSIGNEE__in = peopleConfig('case_bug'))
        elif status == 'NoCaseBug':
            entrys = NoCaseBugModel.objects.filter(REPORTER = pName)
        else:
            entrys = ReporterModel.objects.filter(REPORTER = pName,status = status)

    for k in entrys:
        tmp = {}
        tmp['id'] = k.id
        tmp['projectName'] = k.projectName
        tmp['issuekey'] = k.issuekey
        tmp['SUMMARY'] = k.SUMMARY
        tmp['REPORTER'] = k.REPORTER
        tmp['ASSIGNEE'] = k.ASSIGNEE
        tmp['PRIORITY'] = k.PRIORITY
        tmp['status'] = k.status
        tmp['CREATED'] = k.CREATED

        results.append(tmp)

    return render_to_response('BugDetails_other.html',{
        'pName':pName,
        'status':status,
        'results':results
    })
Example #2
0
def getProData(proName, **args):
    # BUG所属server端或soa端或client端
    typeNum = ['server', 'soa']
    # 每一端BUG的数量
    result = {
        'client': 0,
        'server': 0,
        'soa': 0,
        'all': 0,
    }

    for k in args:
        all = ReporterModel.objects.filter(projectName=proName, status=args[k])
        for bug_type in typeNum:
            entrys = ReporterModel.objects.filter(
                projectName=proName,
                ASSIGNEE__in=peopleConfig(bug_type),
                status=args[k])
            for i in result:
                if i == bug_type:
                    result[i] = len(entrys)
    result['client'] = len(all) - result['server'] - result['soa']
    result['all'] = len(all)

    return result
Example #3
0
def todayBugDetails(request):
    typeNum = ['server','soa']
    results = []
    proName = request.GET['proName']
    status = request.GET['status']
    if proName == u'未规划项目':
        proName = ''

    # 总计里的
    if proName == 'all':
        if status == 'TodayOpen':
            entrys = ReporterModel.objects.filter(CREATED__startswith = nowTime())
        elif status == 'TodayReOpen':
            entrys = ReporterModel.objects.filter(status = 'Reopened',UPDATED__startswith = nowTime())
        elif status == 'TodayClosed':
            entrys = ReporterModel.objects.filter(status = 'Closed',UPDATED__startswith = nowTime())
        elif status == 'CaseBug':
            entrys = ReporterModel.objects.filter(ASSIGNEE__in = peopleConfig('case_bug'))
        elif status == 'NoCaseBug':
            entrys = NoCaseBugModel.objects.all()
        elif status == 'interfaceBug':
            entrys = InterfaceModel.objects.all()
    else:
        if status == 'TodayOpen':
            entrys = ReporterModel.objects.filter(projectName = proName,CREATED__startswith = nowTime())
        elif status == 'TodayReOpen':
            entrys = ReporterModel.objects.filter(projectName = proName,status = 'Reopened',UPDATED__startswith = nowTime())
        elif status == 'TodayClosed':
            entrys = ReporterModel.objects.filter(projectName = proName,status = 'Closed',UPDATED__startswith = nowTime())
        elif status == 'CaseBug':
            entrys = ReporterModel.objects.filter(projectName = proName,ASSIGNEE__in = peopleConfig('case_bug'))
        elif status == 'NoCaseBug':
            entrys = NoCaseBugModel.objects.filter(projectName = proName)
        elif status == 'interfaceBug':
            entrys = InterfaceModel.objects.filter(projectName = proName)

    for k in entrys:
        tmp = {}
        tmp['id'] = k.id
        tmp['projectName'] = k.projectName
        tmp['issuekey'] = k.issuekey
        tmp['SUMMARY'] = k.SUMMARY
        tmp['REPORTER'] = k.REPORTER
        tmp['ASSIGNEE'] = k.ASSIGNEE
        tmp['PRIORITY'] = k.PRIORITY
        tmp['status'] = k.status
        tmp['CREATED'] = k.CREATED

        results.append(tmp)

    if proName == '':
        proName = u'未规划项目'

    return render_to_response('BugDetails_other.html',{
        'proName':proName,
        'status':status,
        'results':results
    })
Example #4
0
def todayBugDetails(request):
    typeNum = ['server', 'soa']
    results = []
    proName = request.GET['proName']
    status = request.GET['status']
    if proName == u'未规划项目':
        proName = ''

    # 总计里的
    if proName == 'all':
        if status == 'TodayOpen':
            entrys = ReporterModel.objects.filter(
                CREATED__startswith=nowTime())
        elif status == 'TodayReOpen':
            entrys = ReporterModel.objects.filter(
                status='Reopened', UPDATED__startswith=nowTime())
        elif status == 'TodayClosed':
            entrys = ReporterModel.objects.filter(
                status='Closed', UPDATED__startswith=nowTime())
        elif status == 'CaseBug':
            entrys = ReporterModel.objects.filter(
                ASSIGNEE__in=peopleConfig('case_bug'))
        elif status == 'NoCaseBug':
            entrys = NoCaseBugModel.objects.all()
        elif status == 'interfaceBug':
            entrys = InterfaceModel.objects.all()
    else:
        if status == 'TodayOpen':
            entrys = ReporterModel.objects.filter(
                projectName=proName, CREATED__startswith=nowTime())
        elif status == 'TodayReOpen':
            entrys = ReporterModel.objects.filter(
                projectName=proName,
                status='Reopened',
                UPDATED__startswith=nowTime())
        elif status == 'TodayClosed':
            entrys = ReporterModel.objects.filter(
                projectName=proName,
                status='Closed',
                UPDATED__startswith=nowTime())
        elif status == 'CaseBug':
            entrys = ReporterModel.objects.filter(
                projectName=proName, ASSIGNEE__in=peopleConfig('case_bug'))
        elif status == 'NoCaseBug':
            entrys = NoCaseBugModel.objects.filter(projectName=proName)
        elif status == 'interfaceBug':
            entrys = InterfaceModel.objects.filter(projectName=proName)

    for k in entrys:
        tmp = {}
        tmp['id'] = k.id
        tmp['projectName'] = k.projectName
        tmp['issuekey'] = k.issuekey
        tmp['SUMMARY'] = k.SUMMARY
        tmp['REPORTER'] = k.REPORTER
        tmp['ASSIGNEE'] = k.ASSIGNEE
        tmp['PRIORITY'] = k.PRIORITY
        tmp['status'] = k.status
        tmp['CREATED'] = k.CREATED

        results.append(tmp)

    if proName == '':
        proName = u'未规划项目'

    return render_to_response('BugDetails_other.html', {
        'proName': proName,
        'status': status,
        'results': results
    })
Example #5
0
def personalBugDetails(request):
    results = []
    pName = request.GET['pName']
    status = request.GET['status']
    # 总计里的
    if pName == 'all':
        if status == 'TodayOpen':
            entrys = ReporterModel.objects.filter(
                CREATED__startswith=nowTime())
        elif status == 'TodayReOpen':
            entrys = ReporterModel.objects.filter(
                status='Reopened', UPDATED__startswith=nowTime())
        elif status == 'TodayClosed':
            entrys = ReporterModel.objects.filter(
                status='Closed', UPDATED__startswith=nowTime())
        elif status == 'CaseBug':
            entrys = ReporterModel.objects.filter(
                ASSIGNEE__in=peopleConfig('case_bug'))
        elif status == 'NoCaseBug':
            entrys = NoCaseBugModel.objects.filter()
        else:
            entrys = ReporterModel.objects.filter(status=status)
    else:
        if status == 'TodayOpen':
            entrys = ReporterModel.objects.filter(
                REPORTER=pName, CREATED__startswith=nowTime())
        elif status == 'TodayReOpen':
            entrys = ReporterModel.objects.filter(
                REPORTER=pName,
                status='Reopened',
                UPDATED__startswith=nowTime())
        elif status == 'TodayClosed':
            entrys = ReporterModel.objects.filter(
                REPORTER=pName, status='Closed', UPDATED__startswith=nowTime())
        elif status == 'CaseBug':
            entrys = ReporterModel.objects.filter(
                REPORTER=pName, ASSIGNEE__in=peopleConfig('case_bug'))
        elif status == 'NoCaseBug':
            entrys = NoCaseBugModel.objects.filter(REPORTER=pName)
        else:
            entrys = ReporterModel.objects.filter(REPORTER=pName,
                                                  status=status)

    for k in entrys:
        tmp = {}
        tmp['id'] = k.id
        tmp['projectName'] = k.projectName
        tmp['issuekey'] = k.issuekey
        tmp['SUMMARY'] = k.SUMMARY
        tmp['REPORTER'] = k.REPORTER
        tmp['ASSIGNEE'] = k.ASSIGNEE
        tmp['PRIORITY'] = k.PRIORITY
        tmp['status'] = k.status
        tmp['CREATED'] = k.CREATED

        results.append(tmp)

    return render_to_response('BugDetails_other.html', {
        'pName': pName,
        'status': status,
        'results': results
    })
Example #6
0
def mainReport(request):
    '''
    pb = {'pName':{'open':xx,'inprogress':xx,'resolved':xx,'closed':xxx,'all':xxx,'link':'/personal.html/'}}
    '''
    '''########################################################################################'''
    # 组员与BUG
    pb = {}
    all = {
        'Open': 0,
        'Reopened': 0,
        'InProgress': 0,
        'Resolved': 0,
        'Closed': 0,
        'CaseBug': 0,
        'NoCaseBug': 0,
        'All': 0,
    }
    pNames = personDisplayName()
    # 某个人的所有信息
    for p in pNames:
        case_entrys = ReporterModel.objects.filter(
            REPORTER=p, ASSIGNEE__in=peopleConfig('case_bug'))
        nocase_entrys = NoCaseBugModel.objects.filter(REPORTER=p)
        case_num = len(case_entrys)
        nocase_num = len(nocase_entrys)

        b = {
            'Open': 0,
            'Reopened': 0,
            'InProgress': 0,
            'Resolved': 0,
            'Closed': 0,
            'CaseBug': 0,
            'NoCaseBug': 0,
            'All': 0,
        }
        b['CaseBug'] = case_num
        all['CaseBug'] += case_num
        b['NoCaseBug'] = nocase_num
        all['NoCaseBug'] += nocase_num

        b['Open'] = getEveryData(p, status='Open')
        all['Open'] += b['Open']
        b['Reopened'] = getEveryData(p, status='Reopened')
        all['Reopened'] += b['Reopened']
        b['InProgress'] = getEveryData(p, status='In Progress')
        all['InProgress'] += b['InProgress']
        b['Resolved'] = getEveryData(p, status='Resolved')
        all['Resolved'] += b['Resolved']
        b['Closed'] = getEveryData(p, status='Closed')
        all['Closed'] += b['Closed']
        b['All'] = b['Open'] + b['Reopened'] + b['InProgress'] + b[
            'Resolved'] + b['Closed']
        all['All'] += b['All']
        pb[p] = b
    '''########################################################################################'''
    # 项目BUG
    pn = {}
    pnAll = {
        'Open': {
            'client': 0,
            'server': 0,
            'soa': 0,
            'all': 0,
        },
        'Reopened': {
            'client': 0,
            'server': 0,
            'soa': 0,
            'all': 0,
        },
        'InProgress': {
            'client': 0,
            'server': 0,
            'soa': 0,
            'all': 0,
        },
        'Resolved': {
            'client': 0,
            'server': 0,
            'soa': 0,
            'all': 0,
        },
        'Closed': {
            'client': 0,
            'server': 0,
            'soa': 0,
            'all': 0,
        },
        'TodayOpen': {
            'client': 0,
            'server': 0,
            'soa': 0,
            'all': 0,
        },
        'TodayReOpen': {
            'client': 0,
            'server': 0,
            'soa': 0,
            'all': 0,
        },
        'TodayClosed': {
            'client': 0,
            'server': 0,
            'soa': 0,
            'all': 0,
        },
        'CaseBug': 0,
        'NoCaseBug': 0,
        'InterfaceBug': 0,
        'All': {
            'client': 0,
            'server': 0,
            'soa': 0,
            'all': 0,
        },
    }
    proNames = getProName()
    for p in proNames:

        # BUG所属server端或soa端或client端
        typeNum = ['server', 'soa']
        # 每一端BUG的数量
        t_o_result = {
            'client': 0,
            'server': 0,
            'soa': 0,
            'all': 0,
        }
        t_r_result = {
            'client': 0,
            'server': 0,
            'soa': 0,
            'all': 0,
        }
        t_c_result = {
            'client': 0,
            'server': 0,
            'soa': 0,
            'all': 0,
        }

        t_o_entrys_all = ReporterModel.objects.filter(
            projectName=p, CREATED__startswith=nowTime())
        t_r_entrys_all = ReporterModel.objects.filter(
            projectName=p, status='Reopened', UPDATED__startswith=nowTime())
        t_c_entrys_all = ReporterModel.objects.filter(
            projectName=p, status='Closed', UPDATED__startswith=nowTime())
        # t_o_result
        for bug_type in typeNum:
            entrys = ReporterModel.objects.filter(
                projectName=p,
                ASSIGNEE__in=peopleConfig(bug_type),
                CREATED__startswith=nowTime())
            for i in t_o_result:
                if i == bug_type:
                    t_o_result[i] = len(entrys)
        # t_r_result
        for bug_type in typeNum:
            entrys = ReporterModel.objects.filter(
                projectName=p,
                ASSIGNEE__in=peopleConfig(bug_type),
                status='Reopened',
                UPDATED__startswith=nowTime())
            for i in t_r_result:
                if i == bug_type:
                    t_r_result[i] = len(entrys)
        # t_c_result
        for bug_type in typeNum:
            entrys = ReporterModel.objects.filter(
                projectName=p,
                ASSIGNEE__in=peopleConfig(bug_type),
                status='Closed',
                UPDATED__startswith=nowTime())
            for i in t_c_result:
                if i == bug_type:
                    t_c_result[i] = len(entrys)

        t_o_result['client'] = len(
            t_o_entrys_all) - t_o_result['server'] - t_o_result['soa']
        t_r_result['client'] = len(
            t_r_entrys_all) - t_r_result['server'] - t_r_result['soa']
        t_c_result['client'] = len(
            t_c_entrys_all) - t_c_result['server'] - t_c_result['soa']

        t_o_result['all'] = len(t_o_entrys_all)
        t_r_result['all'] = len(t_r_entrys_all)
        t_c_result['all'] = len(t_c_entrys_all)

        # 今日数据
        # t_o_entrys = ReporterModel.objects.filter(projectName = p,CREATED__startswith = nowTime() )
        # t_r_entrys = ReporterModel.objects.filter(projectName = p,status = 'Reopened',UPDATED__startswith = nowTime())
        # t_c_entrys = ReporterModel.objects.filter(projectName = p,status = 'Closed',UPDATED__startswith = nowTime())
        case_entrys = ReporterModel.objects.filter(
            projectName=p, ASSIGNEE__in=peopleConfig('case_bug'))

        interface_entrys = InterfaceModel.objects.filter(projectName=p)

        nocase_entrys = NoCaseBugModel.objects.filter(projectName=p)

        case_num = len(case_entrys)
        nocase_num = len(nocase_entrys)
        interface_num = len(interface_entrys)

        b = {
            'Open': {
                'client': 0,
                'server': 0,
                'soa': 0,
                'all': 0,
            },
            'Reopened': {
                'client': 0,
                'server': 0,
                'soa': 0,
                'all': 0,
            },
            'InProgress': {
                'client': 0,
                'server': 0,
                'soa': 0,
                'all': 0,
            },
            'Resolved': {
                'client': 0,
                'server': 0,
                'soa': 0,
                'all': 0,
            },
            'Closed': {
                'client': 0,
                'server': 0,
                'soa': 0,
                'all': 0,
            },
            'TodayOpen': {
                'client': 0,
                'server': 0,
                'soa': 0,
                'all': 0,
            },
            'TodayReOpen': {
                'client': 0,
                'server': 0,
                'soa': 0,
                'all': 0,
            },
            'TodayClosed': {
                'client': 0,
                'server': 0,
                'soa': 0,
                'all': 0,
            },
            'CaseBug': 0,
            'NoCaseBug': 0,
            'InterfaceBug': 0,
            'All': {
                'client': 0,
                'server': 0,
                'soa': 0,
                'all': 0,
            },
        }

        b['InterfaceBug'] = interface_num
        pnAll['InterfaceBug'] += interface_num

        b['CaseBug'] = case_num
        pnAll['CaseBug'] += case_num
        b['NoCaseBug'] = nocase_num
        pnAll['NoCaseBug'] += nocase_num

        b['Open'] = getProData(p, status='Open')
        pnAll['Open']['all'] += b['Open']['all']
        pnAll['Open']['client'] += b['Open']['client']
        pnAll['Open']['server'] += b['Open']['server']
        pnAll['Open']['soa'] += b['Open']['soa']

        b['Reopened'] = getProData(p, status='Reopened')
        pnAll['Reopened']['all'] += b['Reopened']['all']
        pnAll['Reopened']['client'] += b['Reopened']['client']
        pnAll['Reopened']['server'] += b['Reopened']['server']
        pnAll['Reopened']['soa'] += b['Reopened']['soa']

        b['InProgress'] = getProData(p, status='In Progress')
        pnAll['InProgress']['all'] += b['InProgress']['all']
        pnAll['InProgress']['client'] += b['InProgress']['client']
        pnAll['InProgress']['server'] += b['InProgress']['server']
        pnAll['InProgress']['soa'] += b['InProgress']['soa']

        b['Resolved'] = getProData(p, status='Resolved')
        pnAll['Resolved']['all'] += b['Resolved']['all']
        pnAll['Resolved']['client'] += b['Resolved']['client']
        pnAll['Resolved']['server'] += b['Resolved']['server']
        pnAll['Resolved']['soa'] += b['Resolved']['soa']

        b['Closed'] = getProData(p, status='Closed')
        pnAll['Closed']['all'] += b['Closed']['all']
        pnAll['Closed']['client'] += b['Closed']['client']
        pnAll['Closed']['server'] += b['Closed']['server']
        pnAll['Closed']['soa'] += b['Closed']['soa']

        b['TodayOpen'] = t_o_result
        b['TodayReOpen'] = t_r_result
        b['TodayClosed'] = t_c_result

        pnAll['TodayOpen']['all'] += t_o_result['all']
        pnAll['TodayOpen']['client'] += t_o_result['client']
        pnAll['TodayOpen']['server'] += t_o_result['server']
        pnAll['TodayOpen']['soa'] += t_o_result['soa']

        pnAll['TodayReOpen']['all'] += t_r_result['all']
        pnAll['TodayReOpen']['client'] += t_r_result['client']
        pnAll['TodayReOpen']['server'] += t_r_result['server']
        pnAll['TodayReOpen']['soa'] += t_r_result['soa']

        pnAll['TodayClosed']['all'] += t_c_result['all']
        pnAll['TodayClosed']['client'] += t_c_result['client']
        pnAll['TodayClosed']['server'] += t_c_result['server']
        pnAll['TodayClosed']['soa'] += t_c_result['soa']

        b['All']['all'] = b['Open']['all'] + b['Reopened']['all'] + b[
            'InProgress']['all'] + b['Resolved']['all'] + b['Closed']['all']
        b['All']['client'] = b['Open']['client'] + b['Reopened']['client'] + b[
            'InProgress']['client'] + b['Resolved']['client'] + b['Closed'][
                'client']
        b['All']['server'] = b['Open']['server'] + b['Reopened']['server'] + b[
            'InProgress']['server'] + b['Resolved']['server'] + b['Closed'][
                'server']
        b['All']['soa'] = b['Open']['soa'] + b['Reopened']['soa'] + b[
            'InProgress']['soa'] + b['Resolved']['soa'] + b['Closed']['soa']
        pnAll['All']['all'] += b['All']['all']
        pnAll['All']['client'] += b['All']['client']
        pnAll['All']['server'] += b['All']['server']
        pnAll['All']['soa'] += b['All']['soa']

        if p != "":
            pn[p] = b
        else:
            pn[u'未规划项目'] = b

    return render_to_response('MainReport.html', {
        'pb': pb,
        'pn': pn,
        'pnall': pnAll,
        'all': all,
    })
Example #7
0
def mainReport(request):

    '''
    pb = {'pName':{'open':xx,'inprogress':xx,'resolved':xx,'closed':xxx,'all':xxx,'link':'/personal.html/'}}
    '''
    '''########################################################################################'''
    # 组员与BUG
    pb = {}
    all = {
            'Open':0,
            'Reopened':0,
            'InProgress':0,
            'Resolved':0,
            'Closed':0,
            'CaseBug':0,
            'NoCaseBug':0,
            'All':0,
        }
    pNames = personDisplayName()
    # 某个人的所有信息
    for p in pNames:
        case_entrys = ReporterModel.objects.filter(REPORTER = p,ASSIGNEE__in = peopleConfig('case_bug'))
        nocase_entrys = NoCaseBugModel.objects.filter(REPORTER = p)
        case_num = len(case_entrys)
        nocase_num = len(nocase_entrys)

        b = {
            'Open':0,
            'Reopened':0,
            'InProgress':0,
            'Resolved':0,
            'Closed':0,
            'CaseBug':0,
            'NoCaseBug':0,
            'All':0,
        }
        b['CaseBug'] = case_num
        all['CaseBug'] += case_num
        b['NoCaseBug'] = nocase_num
        all['NoCaseBug'] += nocase_num

        b['Open'] = getEveryData(p,status = 'Open')
        all['Open'] += b['Open']
        b['Reopened'] = getEveryData(p,status = 'Reopened')
        all['Reopened'] += b['Reopened']
        b['InProgress'] = getEveryData(p,status = 'In Progress')
        all['InProgress'] += b['InProgress']
        b['Resolved'] = getEveryData(p,status = 'Resolved')
        all['Resolved'] += b['Resolved']
        b['Closed'] = getEveryData(p,status = 'Closed')
        all['Closed'] += b['Closed']
        b['All'] = b['Open'] + b['Reopened'] + b['InProgress'] + b['Resolved'] + b['Closed']
        all['All'] += b['All']
        pb[p] = b
    '''########################################################################################'''
    # 项目BUG
    pn = {}
    pnAll = {
        'Open':{
            'client':0,
            'server':0,
            'soa':0,
            'all':0,
        },
        'Reopened':{
            'client':0,
            'server':0,
            'soa':0,
            'all':0,
        },
        'InProgress':{
            'client':0,
            'server':0,
            'soa':0,
            'all':0,
        },
        'Resolved':{
            'client':0,
            'server':0,
            'soa':0,
            'all':0,
        },
        'Closed':{
            'client':0,
            'server':0,
            'soa':0,
            'all':0,
        },
        'TodayOpen':{
            'client':0,
            'server':0,
            'soa':0,
            'all':0,
        },
        'TodayReOpen':{
            'client':0,
            'server':0,
            'soa':0,
            'all':0,
        },
        'TodayClosed':{
            'client':0,
            'server':0,
            'soa':0,
            'all':0,
        },
        'CaseBug':0,
        'NoCaseBug':0,
        'InterfaceBug':0,
        'All':{
            'client':0,
            'server':0,
            'soa':0,
            'all':0,
        },
    }
    proNames = getProName()
    for p in proNames:

        # BUG所属server端或soa端或client端
        typeNum = ['server','soa']
        # 每一端BUG的数量
        t_o_result = {
            'client':0,
            'server':0,
            'soa':0,
            'all':0,
        }
        t_r_result = {
            'client':0,
            'server':0,
            'soa':0,
            'all':0,
        }
        t_c_result = {
            'client':0,
            'server':0,
            'soa':0,
            'all':0,
        }

        t_o_entrys_all = ReporterModel.objects.filter(projectName = p,CREATED__startswith = nowTime())
        t_r_entrys_all = ReporterModel.objects.filter(projectName = p,status = 'Reopened',UPDATED__startswith = nowTime())
        t_c_entrys_all = ReporterModel.objects.filter(projectName = p,status = 'Closed',UPDATED__startswith = nowTime())
        # t_o_result
        for bug_type in typeNum:
            entrys = ReporterModel.objects.filter(projectName = p,ASSIGNEE__in = peopleConfig(bug_type),CREATED__startswith = nowTime())
            for i in t_o_result:
                if i == bug_type:
                    t_o_result[i] = len(entrys)
        # t_r_result
        for bug_type in typeNum:
            entrys = ReporterModel.objects.filter(projectName = p,ASSIGNEE__in = peopleConfig(bug_type),status = 'Reopened',UPDATED__startswith = nowTime())
            for i in t_r_result:
                if i == bug_type:
                    t_r_result[i] = len(entrys)
        # t_c_result
        for bug_type in typeNum:
            entrys = ReporterModel.objects.filter(projectName = p,ASSIGNEE__in = peopleConfig(bug_type),status = 'Closed',UPDATED__startswith = nowTime())
            for i in t_c_result:
                if i == bug_type:
                    t_c_result[i] = len(entrys)

        t_o_result['client'] = len(t_o_entrys_all) - t_o_result['server'] - t_o_result['soa']
        t_r_result['client'] = len(t_r_entrys_all) - t_r_result['server'] - t_r_result['soa']
        t_c_result['client'] = len(t_c_entrys_all) - t_c_result['server'] - t_c_result['soa']

        t_o_result['all'] = len(t_o_entrys_all)
        t_r_result['all'] = len(t_r_entrys_all)
        t_c_result['all'] = len(t_c_entrys_all)

        # 今日数据
        # t_o_entrys = ReporterModel.objects.filter(projectName = p,CREATED__startswith = nowTime() )
        # t_r_entrys = ReporterModel.objects.filter(projectName = p,status = 'Reopened',UPDATED__startswith = nowTime())
        # t_c_entrys = ReporterModel.objects.filter(projectName = p,status = 'Closed',UPDATED__startswith = nowTime())
        case_entrys = ReporterModel.objects.filter(projectName = p,ASSIGNEE__in = peopleConfig('case_bug'))

        interface_entrys = InterfaceModel.objects.filter(projectName = p)

        nocase_entrys = NoCaseBugModel.objects.filter(projectName = p)

        case_num = len(case_entrys)
        nocase_num = len(nocase_entrys)
        interface_num = len(interface_entrys)

        b = {
            'Open':{
                'client':0,
                'server':0,
                'soa':0,
                'all':0,
            },
            'Reopened':{
                'client':0,
                'server':0,
                'soa':0,
                'all':0,
            },
            'InProgress':{
                'client':0,
                'server':0,
                'soa':0,
                'all':0,
            },
            'Resolved':{
                'client':0,
                'server':0,
                'soa':0,
                'all':0,
            },
            'Closed':{
                'client':0,
                'server':0,
                'soa':0,
                'all':0,
            },
            'TodayOpen':{
                'client':0,
                'server':0,
                'soa':0,
                'all':0,
            },
            'TodayReOpen':{
                'client':0,
                'server':0,
                'soa':0,
                'all':0,
            },
            'TodayClosed':{
                'client':0,
                'server':0,
                'soa':0,
                'all':0,
            },
            'CaseBug':0,
            'NoCaseBug':0,
            'InterfaceBug':0,
            'All':{
                'client':0,
                'server':0,
                'soa':0,
                'all':0,
            },
        }

        b['InterfaceBug'] =interface_num
        pnAll['InterfaceBug'] += interface_num

        b['CaseBug'] = case_num
        pnAll['CaseBug'] += case_num
        b['NoCaseBug'] = nocase_num
        pnAll['NoCaseBug'] += nocase_num

        b['Open'] = getProData(p,status = 'Open')
        pnAll['Open']['all'] += b['Open']['all']
        pnAll['Open']['client'] += b['Open']['client']
        pnAll['Open']['server'] += b['Open']['server']
        pnAll['Open']['soa'] += b['Open']['soa']

        b['Reopened'] = getProData(p,status = 'Reopened')
        pnAll['Reopened']['all'] += b['Reopened']['all']
        pnAll['Reopened']['client'] += b['Reopened']['client']
        pnAll['Reopened']['server'] += b['Reopened']['server']
        pnAll['Reopened']['soa'] += b['Reopened']['soa']

        b['InProgress'] = getProData(p,status = 'In Progress')
        pnAll['InProgress']['all'] += b['InProgress']['all']
        pnAll['InProgress']['client'] += b['InProgress']['client']
        pnAll['InProgress']['server'] += b['InProgress']['server']
        pnAll['InProgress']['soa'] += b['InProgress']['soa']

        b['Resolved'] = getProData(p,status = 'Resolved')
        pnAll['Resolved']['all'] += b['Resolved']['all']
        pnAll['Resolved']['client'] += b['Resolved']['client']
        pnAll['Resolved']['server'] += b['Resolved']['server']
        pnAll['Resolved']['soa'] += b['Resolved']['soa']


        b['Closed'] = getProData(p,status = 'Closed')
        pnAll['Closed']['all'] += b['Closed']['all']
        pnAll['Closed']['client'] += b['Closed']['client']
        pnAll['Closed']['server'] += b['Closed']['server']
        pnAll['Closed']['soa'] += b['Closed']['soa']

        b['TodayOpen'] = t_o_result
        b['TodayReOpen'] = t_r_result
        b['TodayClosed'] = t_c_result


        pnAll['TodayOpen']['all'] += t_o_result['all']
        pnAll['TodayOpen']['client'] += t_o_result['client']
        pnAll['TodayOpen']['server'] += t_o_result['server']
        pnAll['TodayOpen']['soa'] += t_o_result['soa']

        pnAll['TodayReOpen']['all'] += t_r_result['all']
        pnAll['TodayReOpen']['client'] += t_r_result['client']
        pnAll['TodayReOpen']['server'] += t_r_result['server']
        pnAll['TodayReOpen']['soa'] += t_r_result['soa']

        pnAll['TodayClosed']['all'] += t_c_result['all']
        pnAll['TodayClosed']['client'] += t_c_result['client']
        pnAll['TodayClosed']['server'] += t_c_result['server']
        pnAll['TodayClosed']['soa'] += t_c_result['soa']

        b['All']['all'] = b['Open']['all'] + b['Reopened']['all'] + b['InProgress']['all'] + b['Resolved']['all'] + b['Closed']['all']
        b['All']['client'] = b['Open']['client'] + b['Reopened']['client'] + b['InProgress']['client'] + b['Resolved']['client'] + b['Closed']['client']
        b['All']['server'] = b['Open']['server'] + b['Reopened']['server'] + b['InProgress']['server'] + b['Resolved']['server'] + b['Closed']['server']
        b['All']['soa'] = b['Open']['soa'] + b['Reopened']['soa'] + b['InProgress']['soa'] + b['Resolved']['soa'] + b['Closed']['soa']
        pnAll['All']['all'] += b['All']['all']
        pnAll['All']['client'] += b['All']['client']
        pnAll['All']['server'] += b['All']['server']
        pnAll['All']['soa'] += b['All']['soa']

        if p!="":
           pn[p] = b
        else:
           pn[u'未规划项目'] = b



    return render_to_response('MainReport.html',{
        'pb':pb,
        'pn':pn,
        'pnall':pnAll,
        'all':all,

    }
    )
Example #8
0
def getProData(proName,**args):
    # BUG所属server端或soa端或client端
    typeNum = ['server','soa']
    # 每一端BUG的数量
    result = {
        'client':0,
        'server':0,
        'soa':0,
        'all':0,
    }

    for k in args:
        all = ReporterModel.objects.filter(projectName = proName,status = args[k])
        for bug_type in typeNum:
            entrys = ReporterModel.objects.filter(projectName = proName,ASSIGNEE__in = peopleConfig(bug_type),status = args[k])
            for i in result:
                if i == bug_type:
                    result[i] = len(entrys)
    result['client'] = len(all) - result['server'] - result['soa']
    result['all'] = len(all)

    return result