def beam_result(): """ Fast estimate Wall """ data = dict(doc_id=uu_id('item')) data['tag'] = request.form.get('tag') data['wall_tag'] = request.form.get('wall_tag') data['width'] = request.form.get('width') data['depth'] = request.form.get('depth') data['length'] = request.form.get('length') data['amount'] = request.form.get('amount') data['category'] = Category.query.get_or_404(request.form.get('category')) data['topbar'] = request.form.get('topbar') data['midbar'] = request.form.get('midbar') data['botbar'] = request.form.get('botbar') data['stirup'] = request.form.get('stirup') data['topbar_amt'] = request.form.get('topbar_amt') data['midbar_amt'] = request.form.get('midbar_amt') data['botbar_amt'] = request.form.get('botbar_amt') data['stirup_spacing'] = request.form.get('stirup_spacing') beam = Beam(data['doc_id'], data['tag'], data['wall_tag'], data['width'], data['depth'], data['length'], data['amount'], data['category'], data['topbar'], data['midbar'], data['botbar'], data['stirup'], data['stirup_spacing'], data['topbar_amt'], data['midbar_amt'], data['botbar_amt']) db.session.add(beam) db.session.commit() flash('Beam {} added to project!'.format(data['tag']), 'success') return redirect(url_for('index.getwall'))
def column_result(): """ Fast estimate Column """ data = dict(doc_id=uu_id('item')) data['tag'] = request.form.get('tag') data['wg_tag'] = request.form.get('wg_tag') data['category'] = Category.query.get_or_404(request.form.get('category')) data['width'] = request.form.get('width') data['depth'] = request.form.get('depth') data['height'] = request.form.get('height') data['amount'] = request.form.get('amount') data['mainbar'] = request.form.get('main_bar_type') data['compositebar'] = request.form.get('composite_bar_type') data['stirup'] = request.form.get('stir_bar_type') data['mainbar_amt'] = request.form.get('main_bar_amt') data['compositebar_amt'] = request.form.get('composite_bar_amt') data['stirup_spacing'] = request.form.get('stir_spacing') column = Column(data['doc_id'], data['tag'], data['wg_tag'], data['category'], data['width'], data['depth'], data['height'], data['amount'], data['mainbar'], data['compositebar'], data['stirup'], data['stirup_spacing'], data['mainbar_amt'], data['compositebar_amt']) db.session.add(column) db.session.commit() flash('Beam {} added to project!'.format(data['tag']), 'success') return redirect(url_for('index.getwall'))
def wall_result(): """ Fast estimate Wall """ data = dict(doc_id=uu_id('doc')) if request.method == 'POST': data['wall_tag'] = request.form.get('tag') data['length'] = request.form.get('length') data['height'] = request.form.get('height') #data['category'] = Category.query.get_or_404(request.form.get('category')) data['rebar'] = dict(hbar=request.form.get('h_bar_type'), hspacing=request.form.get('h_bar_spacing'), vbar=request.form.get('v_bar_type'), vspacing=request.form.get('v_bar_spacing')) #qsr = qsrep.Stuctural #product = Product(name, price, category, uid) openings_dict = {} openings = Opening.query.filter_by(wall_tag=data['wall_tag']).all() if openings is not None: for opening in openings: openings_dict[opening.tag] = { 'w': opening.width, 'h': opening.height, 'amt': opening.amount } else: openings_dict = None wall_bq = estimator.Walls(data['length'], data['height'], openings_dict) data['estimate'] = wall_bq.wall #wall_data = str(data) #wall_resource = 'http://localhost:8090/wall/:' + wall_data #res = requests.get(wall_resource) #wall_ = loads(res.text) return render_template('wall_result.html', title='FastEstimate Wall', data=data, opening=openings_dict)
def wall_opening(): """ Fast estimate Wall """ data = dict(doc_id=uu_id('item')) data['tag'] = request.form.get('tag') data['wall_tag'] = request.form.get('wall_tag') data['width'] = request.form.get('width') data['height'] = request.form.get('height') data['amount'] = request.form.get('amount') data['category'] = Category.query.get_or_404(request.form.get('category')) opening = Opening(data['tag'], data['wall_tag'], data['width'], data['height'], data['amount'], data['category'], data['doc_id']) db.session.add(opening) db.session.commit() flash('Opening {} added to project!'.format(data['tag']), 'success') return redirect(url_for('index.getwall'))
def foundation_result(): """ Fast estimate Foundation """ data = dict(doc_id=uu_id('item')) data['tag'] = request.form.get('tag') data['wg_tag'] = request.form.get('wg_tag') data['category'] = request.form.get('category') data['width'] = request.form.get('width') data['depth'] = request.form.get('depth') data['thickness'] = request.form.get('thickness') data['length'] = request.form.get('length') data['amount'] = request.form.get('amount') data['topbar'] = request.form.get('top_bar_type') data['midbar'] = request.form.get('mid_bar_type') data['botbar'] = request.form.get('bot_bar_type') data['stirup'] = request.form.get('stir_bar_type') data['topbar_amt'] = request.form.get('top_bar_amt') data['midbar_amt'] = request.form.get('mid_bar_amt') data['botbar_amt'] = request.form.get('bot_bar_amt') data['stirup_spacing'] = request.form.get('stir_spacing') foundation = Foundation(data['doc_id'], data['tag'], data['wg_tag'], data['width'], data['depth'], data['thickness'], data['length'], data['amount'], data['category'], data['topbar'], data['midbar'], data['botbar'], data['stirup'], data['stirup_spacing'], data['topbar_amt'], data['midbar_amt'], data['botbar_amt']) db.session.add(foundation) db.session.commit() flash('Foundation {} added to project!'.format(data['tag']), 'success') return redirect(url_for('index.getwall'))