Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
mason-today-web
Commits
2fdcdada
Commit
2fdcdada
authored
May 14, 2018
by
Zach Osman
Browse files
Adding simple quality testing function
parent
ef0a3684
Changes
1
Hide whitespace changes
Inline
Side-by-side
mason-today/parscript.py
View file @
2fdcdada
...
...
@@ -26,7 +26,22 @@ def cleanup(dirtystring):
dirtystring
=
dirtystring
.
replace
(
replacement
[
0
],
replacement
[
1
])
return
dirtystring
[:
-
1
]
# Simple event quality test
def
qualityTest
(
desc
):
# none, bad, okay, good
length
=
len
(
desc
)
if
length
<
10
:
return
"none"
elif
length
<
40
:
return
"bad"
elif
length
<
80
:
return
"okay"
elif
length
<
100
:
return
"good"
else
:
return
"?"
# convertTime accepts strings in the form of ""
def
convertTime
(
stri
):
# this function is used for splicing the event times.
...
...
@@ -251,9 +266,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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment