Private
Public Access
1
0

Merge branch 'feature/python3' into develop

This commit is contained in:
Sander Roosendaal
2019-02-24 20:38:22 +01:00
52 changed files with 4047 additions and 3997 deletions

View File

@@ -1,4 +1,5 @@
""" Background tasks done by Celery (develop) or QR (production) """
from __future__ import absolute_import
import os
import time
import gc
@@ -16,7 +17,10 @@ from rowingdata import rowingdata as rdata
from datetime import timedelta
from sqlalchemy import create_engine
from celery import app
#from celery import app
from rowers.celery import app
from celery import shared_task
import datetime
import pytz
import iso8601
@@ -39,10 +43,11 @@ from django_rq import job
from django.utils import timezone
from django.utils.html import strip_tags
from utils import deserialize_list,ewmovingaverage,wavg
from emails import htmlstrip
from rowers.utils import deserialize_list,ewmovingaverage,wavg
from rowers.emails import htmlstrip
from HTMLParser import HTMLParser
#from HTMLParser import HTMLParser
from html.parser import HTMLParser
class MLStripper(HTMLParser):
def __init__(self):
self.reset()
@@ -80,13 +85,13 @@ from django.db.utils import OperationalError
from jinja2 import Template,Environment,FileSystemLoader
env = Environment(loader = FileSystemLoader(["rowers/templates"]))
import datautils
import utils
import rowers.datautils as datautils
import rowers.utils as utils
import requests
import longtask
import rowers.longtask as longtask
import arrow
from utils import get_strava_stream
from rowers.utils import get_strava_stream
siteurl = SITE_URL
@@ -128,9 +133,9 @@ def handle_c2_import_stroke_data(c2token,
return 1
else:
url = "https://log.concept2.com/api/users/me/results/"+str(c2id)
url = "https://log.concept2.com/api/users/me/results/{id}".format(id=c2id)
s = requests.get(url,headers=headers)
s = requests.get(url,headers=headers)
if s.status_code == 200:
workoutdata = s.json()['data']
@@ -1238,21 +1243,21 @@ def handle_zip_file(emailfrom, subject, file,**kwargs):
debug = False
if debug:
print message
print(message)
email = EmailMessage(subject, message,
emailfrom,
['workouts@rowsandall.com'])
email.attach_file(file)
if debug:
print "attaching"
print("attaching")
res = email.send()
if debug:
print "sent"
print("sent")
time.sleep(60)
return 1
@@ -1490,9 +1495,8 @@ def handle_updateergcp(rower_id,workoutfilenames,debug=False,**kwargs):
rowdata = rdata(f1 + '.gz')
except IOError:
rowdata = 0
if rowdata != 0:
therows.append(rowdata)
if rowdata != 0:
therows.append(rowdata)
cpdata = rowingdata.cumcpdata(therows)
cpdata.columns = cpdata.columns.str.lower()