|
|
@@ -9,6 +9,7 @@ import psycopg2.extras
|
|
|
from pprint import pprint
|
|
|
import arrow
|
|
|
import view
|
|
|
+import time
|
|
|
|
|
|
|
|
|
import warnings
|
|
|
@@ -106,16 +107,17 @@ def convert_to_date(weird_string):
|
|
|
return calculated_date
|
|
|
|
|
|
|
|
|
-def send_messages(scratches, source):
|
|
|
+def send_messages(scratches, source, start=0):
|
|
|
long_message = ''
|
|
|
|
|
|
- message_string = '{} {}venue = {} {} {}-{} | race = {} starts at {} | {} UTC | horse = {}'
|
|
|
+ message_string = '{} {}venue = {} {} {}-{} | race = {} starts at {} | {} UTC | horse = {}{}'
|
|
|
|
|
|
for m in scratches:
|
|
|
flag = ''
|
|
|
if m.torn:
|
|
|
flag = 'FLAGGED!! '
|
|
|
pprint(m)
|
|
|
+ end = time.time()
|
|
|
message = message_string.format(source,
|
|
|
flag,
|
|
|
m.date.strftime('%a'),
|
|
|
@@ -125,7 +127,8 @@ def send_messages(scratches, source):
|
|
|
m.race,
|
|
|
m.time,
|
|
|
m.utc,
|
|
|
- '{} {}'.format(m.horse_no, m.horse_display_name))
|
|
|
+ '{} {}'.format(m.horse_no, m.horse_display_name),
|
|
|
+ ' | {0:.2f}s'.format(start-end) if start != 0 else '')
|
|
|
print('this_message: {}'.format(message))
|
|
|
# Append message if possible
|
|
|
if len(long_message) + len(message) < 5997:
|