Skip to content

Commit 2ce8ae8

Browse files
committed
Improved results pages
1 parent cd8adda commit 2ce8ae8

2 files changed

Lines changed: 61 additions & 41 deletions

File tree

table_differ/new_server.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,16 @@
88
import datetime
99

1010
import flask
11-
from flask import Flask
1211
from flask import render_template
1312
from flask import request
1413
from flask import url_for
1514
from flask import redirect
1615
from flask import Markup
16+
from flask import send_from_directory
17+
1718
from werkzeug import secure_filename
1819

1920
from app import app
20-
# app = Flask(__name__)
21-
# app.wsgi_app = reverseproxied.ReverseProxied(app.wsgi_app)
2221

2322
ALLOWED_EXTENSIONS = set(['xls', 'xlsx', 'csv'])
2423

@@ -121,6 +120,12 @@ def show_new_results(comparison_id):
121120
len(comparison.same_cells))
122121
report_notes.append(report_note)
123122

123+
for cell in comparison.diff_cells:
124+
report_notes.append("[%s,%s] Expected: %s Actual: %s" %
125+
(cell[0], cell[1],
126+
comparison.expected_table.get_value(cell[0], cell[1]),
127+
comparison.actual_table.get_value(cell[0], cell[1])))
128+
124129
table_rows = []
125130
for row_index in range(comparison.max_rows):
126131
table_row = []
@@ -165,8 +170,6 @@ def uploads():
165170
filename=filename))
166171
return render_template("uploads.html")
167172

168-
from flask import send_from_directory
169-
170173
@app.route('/uploads/<filename>')
171174
def uploaded_file(filename):
172175
return send_from_directory(app.config['UPLOAD_FOLDER'],
@@ -244,4 +247,5 @@ def save_excel_file(file, directory):
244247

245248
if __name__ == "__main__":
246249
app.run(host='0.0.0.0',
250+
port=5005,
247251
debug=True)

table_differ/templates/data_comparison_new_results.html

Lines changed: 52 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,61 @@
22

33
{% block title %}Data Comparison Results{% endblock %}
44

5+
{% block head %}
6+
<script src="{{ url_for('static', filename='jquery.min.js') }}"></script>
7+
<script src="{{ url_for('static', filename='jquery.handsontable.full.js') }}"></script>
8+
<link rel="stylesheet" media="screen" href="{{ url_for('static', filename='jquery.handsontable.full.css') }}">
9+
{% endblock %}
10+
511
{% block page_content %}
612
<div class="container-fluid" id="page-content">
713

8-
{% if options.show_row_col_labels %}
9-
<h1>Report Notes</h1>
10-
11-
<ul>
12-
{% for report_note in report_notes %}
13-
<li>{{ report_note }}</li>
14-
{% endfor %}
15-
</ul>
16-
{% endif %}
17-
18-
<table border="1">
19-
20-
{% if options.show_row_col_labels %}
21-
<tr>
22-
<td/>
23-
{% for cell in table_rows[0] %}
24-
<td>{{ loop.index }}</td>
25-
{% endfor %}
26-
</tr>
27-
{% endif %}
28-
29-
{% for row in table_rows %}
30-
<tr>
31-
{% if options.show_row_col_labels %}
32-
<td>{{ loop.index }}</td>
33-
{% endif %}
34-
35-
{% for cell in row %}
36-
<td class="{{ cell[1] }}">
37-
{{ cell[0] }}
38-
</td>
39-
{% endfor %}
40-
</tr>
41-
{% endfor %}
42-
</table>
43-
</p>
14+
<h1>Results</h1>
15+
<div class="bs-docs-example">
16+
<ul id="myTab" class="nav nav-pills">
17+
<li class="active"><a href="#summary" data-toggle="tab">Summary</a></li>
18+
<li><a href="#results" data-toggle="tab">Grid Comparison</a></li>
19+
</ul>
20+
21+
<div id="myTabContent" class="tab-content">
22+
<div class="tab-pane fade in active" id="summary">
23+
<ul>
24+
{% for report_note in report_notes %}
25+
<li>{{ report_note }}</li>
26+
{% endfor %}
27+
</ul>
28+
</div>
29+
<div class="tab-pane fade" id="results">
30+
<table border="1">
31+
32+
{% if options.show_row_col_labels %}
33+
<tr>
34+
<td/>
35+
{% for cell in table_rows[0] %}
36+
<td>{{ loop.index }}</td>
37+
{% endfor %}
38+
</tr>
39+
{% endif %}
40+
41+
{% for row in table_rows %}
42+
<tr>
43+
{% if options.show_row_col_labels %}
44+
<td>{{ loop.index }}</td>
45+
{% endif %}
46+
47+
{% for cell in row %}
48+
<td class="{{ cell[1] }}">
49+
{{ cell[0] }}
50+
</td>
51+
{% endfor %}
52+
</tr>
53+
{% endfor %}
54+
</table>
55+
</div>
56+
</div>
57+
</div>
58+
4459
</div>
60+
4561
{% endblock %}
4662

0 commit comments

Comments
 (0)