updated time zone in sync
This commit is contained in:
@@ -258,7 +258,7 @@ def createc2workoutdata_as_splits(w):
|
|||||||
"date": w.startdatetime.isoformat(),
|
"date": w.startdatetime.isoformat(),
|
||||||
"distance": int(w.distance),
|
"distance": int(w.distance),
|
||||||
"time": int(10*makeseconds(durationstr)),
|
"time": int(10*makeseconds(durationstr)),
|
||||||
"timezone": "Etc/UTC",
|
"timezone": w.timezone,
|
||||||
"weight_class": c2wc(w.weightcategory),
|
"weight_class": c2wc(w.weightcategory),
|
||||||
"comments": newnotes,
|
"comments": newnotes,
|
||||||
"heart_rate": {
|
"heart_rate": {
|
||||||
@@ -320,7 +320,7 @@ def createc2workoutdata(w):
|
|||||||
data = {
|
data = {
|
||||||
"type": workouttype,
|
"type": workouttype,
|
||||||
"date": w.startdatetime.isoformat(),
|
"date": w.startdatetime.isoformat(),
|
||||||
"timezone": "Etc/UTC",
|
"timezone": w.timezone,
|
||||||
"distance": int(w.distance),
|
"distance": int(w.distance),
|
||||||
"time": int(10*makeseconds(durationstr)),
|
"time": int(10*makeseconds(durationstr)),
|
||||||
"weight_class": c2wc(w.weightcategory),
|
"weight_class": c2wc(w.weightcategory),
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
# Python
|
# Python
|
||||||
import oauth2 as oauth
|
import oauth2 as oauth
|
||||||
|
import pytz
|
||||||
import cgi
|
import cgi
|
||||||
import requests
|
import requests
|
||||||
import requests.auth
|
import requests.auth
|
||||||
@@ -231,7 +232,8 @@ def createrunkeeperworkoutdata(w):
|
|||||||
}
|
}
|
||||||
distancedata.append(point)
|
distancedata.append(point)
|
||||||
|
|
||||||
start_time = w.startdatetime.strftime("%a, %d %b %Y %H:%M:%S")
|
st = w.startdatetime.astimezone(pytz.timezone(w.timezone))
|
||||||
|
start_time = st.strftime("%a, %d %b %Y %H:%M:%S")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
newnotes = w.notes+'\n from '+w.workoutsource+' via rowsandall.com'
|
newnotes = w.notes+'\n from '+w.workoutsource+' via rowsandall.com'
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ from math import sin,cos,atan2,sqrt
|
|||||||
|
|
||||||
import urllib
|
import urllib
|
||||||
import c2stuff
|
import c2stuff
|
||||||
|
import pytz
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render_to_response
|
||||||
@@ -214,6 +215,8 @@ def get_sporttracks_workout(user,sporttracksid):
|
|||||||
|
|
||||||
# Create Workout Data for upload to SportTracks
|
# Create Workout Data for upload to SportTracks
|
||||||
def createsporttracksworkoutdata(w):
|
def createsporttracksworkoutdata(w):
|
||||||
|
timezone = pytz.timezone(w.timezone)
|
||||||
|
|
||||||
filename = w.csvfilename
|
filename = w.csvfilename
|
||||||
try:
|
try:
|
||||||
row = rowingdata(filename)
|
row = rowingdata(filename)
|
||||||
@@ -283,12 +286,14 @@ def createsporttracksworkoutdata(w):
|
|||||||
except TypeError:
|
except TypeError:
|
||||||
w.notes = 'from '+w.workoutsource+' via rowsandall.com'
|
w.notes = 'from '+w.workoutsource+' via rowsandall.com'
|
||||||
|
|
||||||
|
st = w.startdatetime.astimezone(timezone)
|
||||||
|
st = st.replace(microsecond=0)
|
||||||
|
|
||||||
if haslatlon:
|
if haslatlon:
|
||||||
data = {
|
data = {
|
||||||
"type": "Rowing",
|
"type": "Rowing",
|
||||||
"name": w.name,
|
"name": w.name,
|
||||||
# "start_time": str(w.date)+"T"+str(w.starttime)+"Z",
|
"start_time": st.isoformat(),
|
||||||
"start_time": w.startdatetime.isoformat(),
|
|
||||||
"total_distance": int(w.distance),
|
"total_distance": int(w.distance),
|
||||||
"duration": duration,
|
"duration": duration,
|
||||||
"notes": w.notes,
|
"notes": w.notes,
|
||||||
@@ -303,8 +308,7 @@ def createsporttracksworkoutdata(w):
|
|||||||
data = {
|
data = {
|
||||||
"type": "Rowing",
|
"type": "Rowing",
|
||||||
"name": w.name,
|
"name": w.name,
|
||||||
# "start_time": str(w.date)+"T"+str(w.starttime)+"Z",
|
"start_time": st.isoformat(),
|
||||||
"start_time": w.startdatetime.isoformat(),
|
|
||||||
"total_distance": int(w.distance),
|
"total_distance": int(w.distance),
|
||||||
"duration": duration,
|
"duration": duration,
|
||||||
"notes": w.notes,
|
"notes": w.notes,
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ from datetime import timedelta
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
from dateutil import parser
|
from dateutil import parser
|
||||||
import time
|
import time
|
||||||
|
import pytz
|
||||||
import math
|
import math
|
||||||
import gzip
|
import gzip
|
||||||
from math import sin,cos,atan2,sqrt
|
from math import sin,cos,atan2,sqrt
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
# Python
|
# Python
|
||||||
import oauth2 as oauth
|
import oauth2 as oauth
|
||||||
import cgi
|
import cgi
|
||||||
|
import pytz
|
||||||
import requests
|
import requests
|
||||||
import requests.auth
|
import requests.auth
|
||||||
import json
|
import json
|
||||||
@@ -285,7 +286,8 @@ def createunderarmourworkoutdata(w):
|
|||||||
for e in zip(t,spm):
|
for e in zip(t,spm):
|
||||||
spmdata.append([e[0],e[1]])
|
spmdata.append([e[0],e[1]])
|
||||||
|
|
||||||
start_time = w.startdatetime.isoformat()
|
st = w.startdatetime.astimezone(pytz.timezone(w.timezone))
|
||||||
|
start_time = st.isoformat()
|
||||||
|
|
||||||
timeseries = {
|
timeseries = {
|
||||||
"distance": distancedata,
|
"distance": distancedata,
|
||||||
|
|||||||
Reference in New Issue
Block a user