コード例 #1
0
def add_wall() -> str:
    form = WallForm(g.current_invest.id)
    if form.validate_on_submit():
        Wall.add_wall(g.current_invest.id, **form.data)
        flash("You added a new wall.")
        return redirect(url_for("masonry_works.walls"))
    return render_template("production/masonry_works/forms/wall_form.html",
                           title="Add Wall",
                           form=form)
コード例 #2
0
 def test_add_wall(app_and_db, wall_data):
     Wall.add_wall(**wall_data)
     wall = Wall.query.first()
     Wall.add_hole(wall.id, width=1.2, height=2.0, amount=2)
     Wall.add_hole(wall.id, width=2.2, height=2.0, amount=1)
     Wall.add_processing(wall.id, year=2020, month="December", done=0.4)
     assert wall.wall_height == 3.1
     assert wall.gross_wall_area == 32.55
     assert wall.wall_area_to_survey == 23.35
     assert wall.wall_area_to_sale == 29.15
     assert wall.left_to_sale == 0.6
コード例 #3
0
 def test_post(client, test_with_authenticated_user, wall_data):
     Wall.add_wall(**wall_data)
     wall = Wall.query.first()
     wall_data["sector"] = "A"
     form = WallForm(original_local_id=wall.local_id, **wall_data)
     assert wall.sector == "G"
     response = client.post(
         url_for("masonry_works.edit_wall", wall_id=wall.id),
         data=form.data,
         follow_redirects=True,
     )
     assert response.status_code == 200
     assert b"You modified the wall." in response.data
     assert wall.sector == "A"
コード例 #4
0
def add_wall(app_and_db, wall_data):
    Wall.add_wall(**wall_data)