예제 #1
0
def executionStatusUser_gviz(request, tqParams, tqxParams):
    """
    Given the dictionaries from the google viz api GET request, return the data
    table via JSON to the client side. This calculates the execution status
    timeline, bar chart, and table on the user dashboard execution status tab.    
    """

    # Get the user and the testing scope
    team, release = getTeamAndReleaseObjectsFromSession(request.session)
    msg = "Unknown user id %s" % tqParams["user"]
    try:
        user = FortyTwoUser.objects.get(id=tqParams["user"])

    except:
        msg = "An unknown user id %s was specified in this request." % tqParams["user"]
        return formatGoogleErrorMessageAndReturn(msg, tqxParams)

    # Get the sprints for the time period requested
    try:
        startSprint, endSprint = getStartEndSprints(tqParams["sprint"], release)
    except ProjectSchedule.DoesNotExist:
        if tqParams["sprint"] == "current":
            msg = "There is no current sprint defined for this project."
        else:
            msg = "A sprint for the time period requested does not exist."
        return formatGoogleErrorMessageAndReturn(msg, tqxParams)

    # Compute the test execution status
    return computeExecutionStatus(
        Q(owner=user, team=team, release=release), startSprint, endSprint, tqParams, tqxParams
    )
예제 #2
0
def executionStatusProject_gviz(request, tqParams, tqxParams):
    """
    Given the dictionaries from the google viz api GET request, return the data
    table via JSON to the client side. This calculates the execution status
    timeline, bar chart, and table on the project dashboard execution status tab.    
    """
    # Get the testing scope
    team, release = getTeamAndReleaseObjectsFromSession(request.session)

    # Get the sprints for the time period requested
    try:
        startSprint, endSprint = getStartEndSprints(tqParams["sprint"], release)
    except ProjectSchedule.DoesNotExist:
        msg = "A sprint for the time period requested does not exist."
        return formatGoogleErrorMessageAndReturn(msg, tqxParams)

    # Compute the test execution status
    return computeExecutionStatus(Q(team=team, release=release), startSprint, endSprint, tqParams, tqxParams)
예제 #3
0
def getProjectActiveState(request):
    """ 
    Return a boolean for if the current release is "active" or not. This means 
    that the current date is within the bounds of one of the ProjectSchedule
    objects for that release/project.
    """
    # 61199: There are two SQL calls in every page load that are unnecessary
    # Due to the above, I'm caching the Active status of the project for the rest of the day

    _, release = getTeamAndReleaseObjectsFromSession(request.session)
    if release:
        cacheLocation = "%s_%s" % (datetime.date.today().isoformat(), release.id)
        active = cache.get(cacheLocation)
        if active is None:
            active = release.project.isActive()

            now = datetime.datetime.today()
            secondsLeftInDay = 24 * 60 * 60 - (now.hour * 60 * 60 + now.minute * 60 + now.second)
            cache.set(cacheLocation, active, secondsLeftInDay)
    else:
        active = False
    return {"PROJECT_ACTIVE": active}
예제 #4
0
def getTeamReleaseAndForms(request):
    team, release = getTeamAndReleaseObjectsFromSession(request.session)
    return {"team": team, "release": release, "teamform": getTeamForm(team), "releaseform": getReleaseForm(release)}