forked from sampottinger/ljsimpleregisterlookup
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlj_error_scribe.py
More file actions
25 lines (18 loc) · 834 Bytes
/
lj_error_scribe.py
File metadata and controls
25 lines (18 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import json
import os
import flask
from flask import Markup, request
from ljm_constants import ljmmm
def format_errors(high, low):
raw_error = list(zip(ljmmm.get_errors()))
#sort errors based on high and low values
output_dict = find_error_range_from_errors(low, high, raw_error)
#send filtered json to tag_summary_template_error.html for rendering
for x in range(0,len(output_dict)):
data = json.loads(json.dumps(output_dict[x][0]))
if "description" in data:
data["description"] = ljmmm.apply_anchors(data["description"])
output_dict[x] = data
return flask.render_template("tag_summary_template_error.html", tag = output_dict)
def find_error_range_from_errors(low, high, raw_error):
return [x for x in raw_error if x[0]['error'] >= low and x[0]['error'] <= high]