示例#1
0
 def test_get_project_details(self):
     project_code = "12345"
     project_details = project_view_services.get_project_details(
         project_code)
     assert project_details.project_code == "12345"
     assert project_details.project_name == "Project A"
     assert project_details.project_category is None
示例#2
0
def edit_costcode_get():
    project_code = flask.request.args.get("project")
    costcode = flask.request.args.get("costcode")
    # check if project exists
    if projects_service.check_if_project_exists(project_code) is False:
        flask.abort(404)
    # check if costcode exists
    if (
        costcode_services.check_if_costcode_exists(
            project_code=project_code, costcode=costcode
        )
        is False
    ):
        flask.abort(404)
    # get project details
    project_details = project_view_services.get_project_details(project_code)
    form = CreateCostcodeForm()
    # get costcode data
    costcode_data = costcode_services.get_costcode_data(
        project_code=project_code, costcode=costcode
    )
    return flask.render_template(
        "admin/edit_costcode.html",
        form=form,
        project_details=project_details,
        costcode_data=costcode_data,
    )
示例#3
0
def costcodes_view(project):
    project_details = project_view_services.get_project_details(project)
    project_costcode_detail = costcode_services.get_costcodes(project)
    project_financial_summary = project_view_services.get_project_financial_summary(
        project)
    return flask.render_template(
        "project/costcodes.html",
        project_details=project_details,
        project_costcode_detail=project_costcode_detail,
        project_financial_summary=project_financial_summary,
    )
示例#4
0
def project_view(project):
    project_details = project_view_services.get_project_details(project)
    project_costcode_detail = costcode_services.get_costcodes_and_transaction_values(
        project)
    project_financial_summary = project_view_services.get_project_financial_summary(
        project)
    return flask.render_template(
        "project/project.html",
        project_details=project_details,
        project_costcode_detail=project_costcode_detail,
        project_financial_summary=project_financial_summary,
    )
示例#5
0
def single_costcode_view(project, costcode):
    project_details = project_view_services.get_project_details(project)
    costcode_details = costcode_services.get_costcode_data(project, costcode)
    transactions, transactions_sum = transaction_services.get_current_transactions(
        project, costcode)
    project_financial_summary = project_view_services.get_project_financial_summary(
        project)
    return flask.render_template(
        "costcode/single_costcode.html",
        project_details=project_details,
        costcode_details=costcode_details,
        transactions=transactions,
        transactions_sum=transactions_sum,
        project_financial_summary=project_financial_summary,
    )