def compare_baseline(): if request.method == 'GET': return compare_baseline_view(None) baseline = models.Baseline.get( models.Baseline.id == request.form['baseline_id']) baseline_path = get_excel_file_path(baseline.file) actual_file = save_excel_file(request.files['compare_file'], 'actual') expected_results_table = td_parsers.load_table_from_xls(baseline_path) actual_results_table = td_parsers.load_table_from_xls( get_excel_file_path(actual_file.id)) # Note: Could we join here using the ORM instead? comparison_record = models.ComparisonType.get( models.ComparisonType.id == baseline.comparison) comparison = compare_data.compare_tables(expected_results_table, actual_results_table, comparison_record.name) comparison_id = td_persist.store_new_comparison(comparison) td_thumbnail.create_comparison_image(comparison, comparison_id) redirect_url = url_for('show_new_results', comparison_id=comparison_id) return redirect(redirect_url)
def xls_worksheet_compare(): if request.method == 'GET': return render_template( 'xls_worksheet_compare.html', header_tab_classes={'xls-worksheet-compare': 'active'}) worksheet_results_file = request.files['worksheet_file'] if worksheet_results_file and allowed_file( worksheet_results_file.filename): filename = secure_filename(worksheet_results_file.filename) file_location = os.path.join(app.config['UPLOAD_FOLDER'], filename) worksheet_results_file.save(file_location) expected_worksheet_name = "Reference" actual_worksheet_name = "Actual" expected_results_table = td_parsers.load_table_from_xls( file_location, expected_worksheet_name) actual_results_table = td_parsers.load_table_from_xls( file_location, actual_worksheet_name) comparison = compare_data.compare_tables(expected_results_table, actual_results_table, td_comparison.COMPARE_RE_SKIP) comparison_id = td_persist.store_new_comparison(comparison) td_thumbnail.create_comparison_image(comparison, comparison_id) redirect_url = url_for('show_new_results', comparison_id=comparison_id) return redirect(redirect_url) return redirect(url_for('xls_worksheet_compare'))
def quick_compare(): if request.method == 'GET': comparison_types = models.ComparisonType.select() return render_template('quick_compare.html', header_tab_classes={'quick-compare': 'active'}, comparison_types=comparison_types) baseline_file = save_excel_file(request.files['baseline_file'], 'actual') actual_file = save_excel_file(request.files['comparison_file'], 'actual') expected_results_table = td_parsers.load_table_from_xls( get_excel_file_path(baseline_file.id)) actual_results_table = td_parsers.load_table_from_xls( get_excel_file_path(actual_file.id)) comparison_record = models.ComparisonType.get( models.ComparisonType.id == request.form['comparison_type']) comparison = compare_data.compare_tables(expected_results_table, actual_results_table, comparison_record.name) comparison_id = td_persist.store_new_comparison(comparison) td_thumbnail.create_comparison_image(comparison, comparison_id) # Note: We could delete the files once we're done with a quick comparison. redirect_url = url_for('show_new_results', comparison_id=comparison_id) return redirect(redirect_url)
def xls_worksheet_compare(): if request.method == 'GET': return render_template('xls_worksheet_compare.html', header_tab_classes={'xls-worksheet-compare': 'active'}) worksheet_results_file = request.files['worksheet_file'] if worksheet_results_file and allowed_file(worksheet_results_file.filename): filename = secure_filename(worksheet_results_file.filename) file_location = os.path.join(app.config['UPLOAD_FOLDER'], filename) worksheet_results_file.save(file_location) expected_worksheet_name = "Reference" actual_worksheet_name = "Actual" expected_results_table = td_parsers.load_table_from_xls(file_location, expected_worksheet_name) actual_results_table = td_parsers.load_table_from_xls(file_location, actual_worksheet_name) comparison = compare_data.compare_tables(expected_results_table, actual_results_table, td_comparison.COMPARE_RE_SKIP) comparison_id = td_persist.store_new_comparison(comparison) td_thumbnail.create_comparison_image(comparison, comparison_id) redirect_url = url_for('show_new_results', comparison_id=comparison_id) return redirect(redirect_url) return redirect(url_for('xls_worksheet_compare'))
def test_sheet_data(): if request.method == 'GET': t = td_parsers.load_table_from_xls('test_sheet.xls', 'MainSheet') data = [] for row in t.rows: data.append(row) response = {"result": "ok", "data": data} return flask.jsonify(response)
def compare_baseline(): if request.method == 'GET': return compare_baseline_view(None) baseline = models.Baseline.get(models.Baseline.id == request.form['baseline_id']) baseline_path = get_excel_file_path(baseline.file) actual_file = save_excel_file(request.files['compare_file'], 'actual') expected_results_table = td_parsers.load_table_from_xls(baseline_path) actual_results_table = td_parsers.load_table_from_xls(get_excel_file_path(actual_file.id)) # Note: Could we join here using the ORM instead? comparison_record = models.ComparisonType.get(models.ComparisonType.id == baseline.comparison) comparison = compare_data.compare_tables(expected_results_table, actual_results_table, comparison_record.name) comparison_id = td_persist.store_new_comparison(comparison) redirect_url = url_for('show_new_results', comparison_id=comparison_id) return redirect(redirect_url)
def get_baseline_grid_data(): baseline = models.Baseline.get(models.Baseline.id == request.form['baseline_id']) file_path = get_excel_file_path(baseline.file) t = td_parsers.load_table_from_xls(file_path) data = [] for row in t.rows: data.append(row) response = {"result": "ok", "data": data} return flask.jsonify(response)
def get_baseline_grid_data(): baseline = models.Baseline.get( models.Baseline.id == request.form['baseline_id']) file_path = get_excel_file_path(baseline.file) t = td_parsers.load_table_from_xls(file_path) data = [] for row in t.rows: data.append(row) response = {"result": "ok", "data": data} return flask.jsonify(response)
def quick_compare(): if request.method == 'GET': comparison_types = models.ComparisonType.select() return render_template('quick_compare.html', header_tab_classes={'quick-compare': 'active'}, comparison_types=comparison_types) baseline_file = save_excel_file(request.files['baseline_file'], 'actual') actual_file = save_excel_file(request.files['comparison_file'], 'actual') expected_results_table = td_parsers.load_table_from_xls(get_excel_file_path(baseline_file.id)) actual_results_table = td_parsers.load_table_from_xls(get_excel_file_path(actual_file.id)) comparison_record = models.ComparisonType.get(models.ComparisonType.id == request.form['comparison_type']) comparison = compare_data.compare_tables(expected_results_table, actual_results_table, comparison_record.name) comparison_id = td_persist.store_new_comparison(comparison) # Note: We could delete the files once we're done with a quick comparison. redirect_url = url_for('show_new_results', comparison_id=comparison_id) return redirect(redirect_url)