Commit 6a72b33e authored by Landon DeCoito's avatar Landon DeCoito
Browse files

Merge branch 'Quality' into 'master'

Adding simple quality test for events

See merge request !31
parents ef0a3684 9820c6a9
......@@ -102,3 +102,5 @@ venv.bak/
# mypy
.mypy_cache/
./masontoday
......@@ -27,6 +27,23 @@ def cleanup(dirtystring):
return dirtystring[:-1]
# Simple event quality test
def qualityTest(desc):
# none, bad, okay, good
length = len(desc)
if desc == "Not Provided":
return "none"
elif length < 10:
return "bad"
elif length < 40:
return "okay"
elif length < 80:
return "good"
elif length < 100:
return "verygood"
else:
return "excellent"
# convertTime accepts strings in the form of ""
def convertTime(stri): # this function is used for splicing the event times.
......@@ -251,9 +268,10 @@ def load_data():
print description
print "----------------------------------------------------------------------------"
'''
if (error == []):
dictlist.append({"id": uniqueid, "title": entry_title, "dayofweek": day, "dayofmonth": monthday, "month": month, "year": year, "timestart": timestart, "timestop": timestop, "location": location, "description": description})
quality = qualityTest(description)
dictlist.append({"id": uniqueid, "quality": quality, "title": entry_title, "dayofweek": day, "dayofmonth": monthday, "month": month,
"year": year, "timestart": timestart, "timestop": timestop, "location": location, "description": description})
else:
dictlist.append({"id": uniqueid, "error": error})
return dictlist
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment