コード例 #1
0
def get_issue_form(global_config, issue_id):
    global_config['logger'].debug( 'GET Issue Form, Issue: %s', issue_id )
        
    session = DbSession.open_db_session(global_config['issues_db_name'] + global_config['this_season'])
    users_session = DbSession.open_db_session(global_config['users_db_name'] + global_config['this_season'])

    issue_id = issue_id
    platform = issue_id.split('-')[0]
    issue = IssueTrackerDataModel.getIssue(session, issue_id)
    
    form = issueform()
    form[issue_id_label].value = issue_id
    form[issue_platform_label].value = platform
    form[issue_summary_label].value = issue.summary
    form[issue_status_label].value = issue.status
    form[issue_priority_label].value = issue.priority
    
    # TODO: can also extract the subgroup and taskgroup(component) lists from the 
    #       database and override the form with the contents
    #       IssueTrackerDataModel.getSubgroupList() and getTaskgroupList()
    form[issue_subgroup_label].value = issue.subgroup
    form[issue_component_label].value = issue.component
    
    # apply the valid list of user names to the dropdown 
    # for the owner field and the submitter field
    username_list = UsersDataModel.getDisplayNameList(users_session)
    form[issue_owner_label].args = username_list
    form[issue_submitter_label].args = username_list

    form[issue_owner_label].value = issue.owner
    form[issue_submitter_label].value = issue.submitter
    form[issue_description_label].value = issue.description

    return form
コード例 #2
0
def get_issue_json(global_config, issue_id, allow_update=False):
    session = DbSession.open_db_session(global_config['issues_db_name'] + global_config['this_season'])
    issue = IssueTrackerDataModel.getIssue(session, issue_id)
    if issue:
        return issue.json()
    else:
        return None
コード例 #3
0
def get_issue_page(global_config, issue_id, allow_update=False):
    session = DbSession.open_db_session(global_config['issues_db_name'] + global_config['this_season'])
    issue = IssueTrackerDataModel.getIssue(session, issue_id)
    result = None
    if issue:
        result = ''
        result += '<hr>'
    
        table_str = '<ul>'
        table_str += '<table border="1" cellspacing="5">'
        
        table_str += '<tr>'
        table_str += '<td>' + issue_id_label + '</td>'
        table_str += '<td>' + issue.issue_id + '</td>'
        table_str += '</tr>'
        table_str += '<tr>'
        table_str += '<td>' + issue_summary_label + '</td>'
        table_str += '<td>' + issue.summary + '</td>'
        table_str += '</tr>'
        table_str += '<tr>'
        table_str += '<td>' + issue_status_label + '</td>'
        table_str += '<td>' + issue.status + '</td>'
        table_str += '</tr>'
        table_str += '<tr>'
        table_str += '<td>' + issue_priority_label + '</td>'
        table_str += '<td>' + issue.priority + '</td>'
        table_str += '</tr>'
        table_str += '<tr>'
        table_str += '<td>' + issue_subgroup_label + '</td>'
        table_str += '<td>' + issue.subgroup + '</td>'
        table_str += '</tr>'
        table_str += '<tr>'
        table_str += '<td>' + issue_component_label + '</td>'
        table_str += '<td>' + issue.component + '</td>'
        table_str += '</tr>'
        table_str += '<tr>'
        table_str += '<td>' + issue_owner_label + '</td>'
        table_str += '<td>' + issue.owner + '</td>'
        table_str += '</tr>'
        table_str += '<tr>'
        table_str += '<td>' + issue_submitter_label + '</td>'
        table_str += '<td>' + issue.submitter + '</td>'
        table_str += '</tr>'
        table_str += '<tr>'
        table_str += '<td>' + issue_description_label + '</td>'
        table_str += '<td>' + issue.description + '</td>'
        table_str += '</tr>'
        table_str += '<tr>'
        table_str += '<td>' + issue_last_modified_label + '</td>'
        table_str += '<td>' + time.strftime('%b %d, %Y %I:%M:%S %p', time.localtime(float(issue.timestamp))) + '</td>'
        #table_str += '<td>' + time.strftime('%c', time.localtime(float(issue.timestamp))) + '</td>'
        table_str += '</tr>'
    
        if issue.debrief_key != None:
            match_str = issue.debrief_key.split('_')[0]           
            table_str += '<td>' + 'Reported In:' + '</td>'
            table_str += '<td><a href="/debrief/' + match_str + '">' + 'Match ' + match_str + '</a></td>'
            table_str += '</tr>'

        table_str += '</table>'
        table_str += '</ul>'
        result += table_str
        
        # result += '<br>'
        result += '<hr>'
        
        if global_config['issues_db_master'] == 'Yes' and allow_update == True:
            result += '<a href="/issueupdate/' + issue_id + '"> Update This Issue</a>'
            result += '<br>'
        result += '<a href="/issuecomment/' + issue_id + '"> Comment On This Issue</a>'
        result += '<br>'
        result += '<hr>'
        result += '<h3>Comments</h3>'
        
        comments = IssueTrackerDataModel.getIssueComments(session, issue_id)
        if len(comments) > 0:
            table_str = '<ul>'
            table_str += '<table border="1" cellspacing="5">'
            table_str += '<tr>'
            table_str += '<th>Timestamp</th>'
            table_str += '<th>Commented By</th>'
            table_str += '<th>Comment</th>'
            if allow_update == True:
                table_str += '<th>Delete</th>'
            table_str += '</tr>'
            for comment in comments:      
                table_str += '<tr>'
                table_str += '<td>' + time.strftime('%b %d, %Y %I:%M:%S %p', time.localtime(float(comment.tag))) + '</td>'
                table_str += '<td>' + comment.submitter + '</td>'
                table_str += '<td>' + comment.data + '</td>'
                if global_config['issues_db_master'] == 'Yes' and allow_update == True:
                    table_str += '<td><a href="/deletecomment/issue/' + issue_id + '/' + comment.tag + '">Delete</a></td>'

                table_str += '</tr>'
            table_str += '</table>'
            table_str += '</ul>'
        
            result += table_str   
        result += '<hr>'
      
    session.remove()
    return result    
コード例 #4
0
def get_debrief_page(global_config, competition, match_str, allow_update=False):

    session = DbSession.open_db_session(global_config["debriefs_db_name"] + global_config["this_season"])
    debrief = DebriefDataModel.getDebrief(session, competition, int(match_str))
    debrief_issues = DebriefDataModel.getDebriefIssues(session, competition, int(match_str))
    issues_session = DbSession.open_db_session(global_config["issues_db_name"] + global_config["this_season"])

    if debrief != None:
        result = ""
        result += "<hr>"

        table_str = "<h4>Match Info</h4>"
        table_str += "<ul>"
        table_str += '<table border="1" cellspacing="5">'
        table_str += "<tr>"
        table_str += "<td>Summary</td>"
        table_str += "<td>" + debrief.summary + "</td>"
        table_str += "</tr>"

        table_str += "<tr>"
        table_str += "<td>Description</td>"
        table_str += "<td>" + debrief.description + "</td>"
        table_str += "</tr>"
        table_str += "</table>"
        table_str += "</ul>"

        table_str += "<h4>Reported Issues From Match</h4>"
        table_str += "<ul>"
        table_str += '<table border="1" cellspacing="5">'
        for issue in debrief_issues:
            table_str += "<tr>"
            table_str += "<td>" + issue.priority + "</td>"
            table_str += '<td><a href="/issue/' + str(issue.issue_id) + '">' + str(issue.issue_id) + "</a></td>"
            issue = IssueTrackerDataModel.getIssue(issues_session, issue.issue_id)
            if issue:
                table_str += "<td>" + issue.summary + "</td>"

            table_str += "</tr>"
        table_str += "</table>"
        table_str += "</ul>"

        result += table_str

        result += "<br>"
        result += "<hr>"
        result += '<a href="/debriefcomment/' + competition + "/" + match_str + '"> Comment On This Match</a></td>'
        result += "<br>"
        result += "<hr>"
        result += "<h3>Comments</h3>"

        comments = DebriefDataModel.getDebriefComments(session, competition, int(match_str))
        if len(comments) > 0:
            table_str = "<ul>"
            table_str += '<table border="1" cellspacing="5">'
            table_str += "<tr>"
            table_str += "<th>Timestamp</th>"
            table_str += "<th>Commented By</th>"
            table_str += "<th>Comment</th>"
            if allow_update == True:
                table_str += "<th>Delete</th>"
            table_str += "</tr>"
            for comment in comments:
                table_str += "<tr>"
                table_str += (
                    "<td>" + time.strftime("%b %d, %Y %I:%M:%S %p", time.localtime(float(comment.tag))) + "</td>"
                )
                table_str += "<td>" + comment.submitter + "</td>"
                table_str += "<td>" + comment.data + "</td>"
                if allow_update == True:
                    table_str += (
                        '<td><a href="/deletecomment/debrief/'
                        + competition
                        + "/"
                        + match_str
                        + "/"
                        + comment.tag
                        + '">Delete</a></td>'
                    )
                table_str += "</tr>"
            table_str += "</table>"
            table_str += "</ul>"

            result += table_str
        result += "<hr>"

        return result
    else:
        return None