fixes and additions
This commit is contained in:
@@ -109,7 +109,7 @@ import pyarrow as pa
|
||||
|
||||
from pyarrow.lib import ArrowInvalid
|
||||
|
||||
from django.utils import timezone
|
||||
from django.utils import timezone as tz
|
||||
from django.utils.timezone import get_current_timezone
|
||||
from django.urls import reverse
|
||||
import requests
|
||||
@@ -276,7 +276,7 @@ def check_marker(workout):
|
||||
def workout_summary_to_df(
|
||||
rower,
|
||||
startdate=datetime.datetime(1970, 1, 1),
|
||||
enddate=timezone.now()+timezone.timedelta(days=1)):
|
||||
enddate=tz.now()+tz.timedelta(days=1)):
|
||||
|
||||
ws = Workout.objects.filter(
|
||||
user=rower, date__gte=startdate, date__lte=enddate,
|
||||
@@ -636,7 +636,7 @@ def setcp(workout, background=False, recurrance=True):
|
||||
|
||||
|
||||
def update_wps(r, types, mode='water', asynchron=True):
|
||||
firstdate = timezone.now()-datetime.timedelta(days=r.cprange)
|
||||
firstdate = tz.now()-datetime.timedelta(days=r.cprange)
|
||||
workouts = Workout.objects.filter(
|
||||
date__gte=firstdate,
|
||||
workouttype__in=types,
|
||||
@@ -702,7 +702,7 @@ def join_workouts(r, ids, title='Joined Workout',
|
||||
notes = ''
|
||||
summary = ''
|
||||
makeprivate = False
|
||||
startdatetime = timezone.now()
|
||||
startdatetime = tz.now()
|
||||
|
||||
if setprivate is True and makeprivate is False: # pragma: no cover
|
||||
makeprivate = True
|
||||
@@ -801,7 +801,7 @@ def fetchcp_new(rower, workouts):
|
||||
|
||||
|
||||
def update_rolling_cp(r, types, mode='water', dosend=False):
|
||||
firstdate = timezone.now()-datetime.timedelta(days=r.cprange)
|
||||
firstdate = tz.now()-datetime.timedelta(days=r.cprange)
|
||||
workouts = Workout.objects.filter(
|
||||
date__gte=firstdate,
|
||||
workouttype__in=types,
|
||||
@@ -1425,10 +1425,12 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
||||
w.save()
|
||||
except ValidationError: # pragma: no cover
|
||||
try:
|
||||
w.startdatetime = timezone.now()
|
||||
w.startdatetime = tz.now()
|
||||
w.save()
|
||||
except ValidationError:
|
||||
return (0, 'Unable to create your workout')
|
||||
except AttributeError:
|
||||
return (0, 'Unable to create your workout')
|
||||
|
||||
if privacy == 'visible':
|
||||
ts = Team.objects.filter(rower=r)
|
||||
@@ -1631,28 +1633,32 @@ def new_workout_from_file(r, f2,
|
||||
startdatetime=startdatetime,
|
||||
))
|
||||
|
||||
id, message = save_workout_database(
|
||||
f2, r,
|
||||
notes=notes,
|
||||
workouttype=workouttype,
|
||||
weightcategory=r.weightcategory,
|
||||
adaptiveclass=r.adaptiveclass,
|
||||
boattype=boattype,
|
||||
makeprivate=makeprivate,
|
||||
dosummary=dosummary,
|
||||
workoutsource=workoutsource,
|
||||
summary=summary,
|
||||
startdatetime=startdatetime,
|
||||
timezone=timezone,
|
||||
rpe=rpe,
|
||||
inboard=inboard, oarlength=oarlength,
|
||||
seatnumber=seatnumber, boatname=boatname,
|
||||
empowerside=empowerside,
|
||||
title=title,
|
||||
forceunit='N',
|
||||
impeller=impeller,
|
||||
workoutid=workoutid,
|
||||
)
|
||||
try:
|
||||
id, message = save_workout_database(
|
||||
f2, r,
|
||||
notes=notes,
|
||||
workouttype=workouttype,
|
||||
weightcategory=r.weightcategory,
|
||||
adaptiveclass=r.adaptiveclass,
|
||||
boattype=boattype,
|
||||
makeprivate=makeprivate,
|
||||
dosummary=dosummary,
|
||||
workoutsource=workoutsource,
|
||||
summary=summary,
|
||||
startdatetime=startdatetime,
|
||||
timezone=timezone,
|
||||
rpe=rpe,
|
||||
inboard=inboard, oarlength=oarlength,
|
||||
seatnumber=seatnumber, boatname=boatname,
|
||||
empowerside=empowerside,
|
||||
title=title,
|
||||
forceunit='N',
|
||||
impeller=impeller,
|
||||
workoutid=workoutid,
|
||||
)
|
||||
except ValueError:
|
||||
message = "error saving"
|
||||
id = 0
|
||||
|
||||
return (id, message, f2)
|
||||
|
||||
@@ -1696,7 +1702,7 @@ def new_workout_from_df(r, df,
|
||||
makeprivate = False
|
||||
rpe = 0
|
||||
if startdatetime == '': # pragma: no cover
|
||||
startdatetime = timezone.now()
|
||||
startdatetime = tz.now()
|
||||
|
||||
if setprivate: # pragma: no cover
|
||||
makeprivate = True
|
||||
|
||||
@@ -56,6 +56,9 @@
|
||||
<th align="left">Edit</th>
|
||||
<th align="left">Clone</th>
|
||||
<th align="left">Delete</th>
|
||||
{% if rower.intervals_token %}
|
||||
<th align="left">Intervals.icu</th>
|
||||
{% endif %}
|
||||
<th align="left">Planned</th>
|
||||
<th align="left">Actual</th>
|
||||
<th align="left"> </th>
|
||||
@@ -119,15 +122,26 @@
|
||||
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<td>
|
||||
{% if ps.manager == request.user %}
|
||||
<a class="small"
|
||||
href="/rowers/sessions/{{ ps.id }}/deleteconfirm"><i class="fas fa-trash-alt fa-fw"></i></a>
|
||||
{% else %}
|
||||
<a class="small"
|
||||
href="/rowers/sessions/{{ ps.id }}/removeme/"><i class="fas fa-user-times"></i></a>
|
||||
href="/rowers/sessions/{{ ps.id }}/removeme/"><i class="fas fa-user-times"></i></a>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% if rower.intervals_token %}
|
||||
<td>
|
||||
{% if ps.intervals_icu_id %}
|
||||
<a class="small"
|
||||
href="https://intervals.icu/?w={{ ps.preferreddate }}"><i class="fa-kit fa-solid-wave-pulse-circle-check"></i></a>
|
||||
{% else %}
|
||||
<a class="small"
|
||||
href="/rowers/sessions/{{ ps.id }}/tointervals/?next={{ request.path }}?startdate={{ request.GET.startdate }}&enddate={{ request.GET.enddate }}"><i class="fa-solid fa-wave-pulse"></i></a>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
<td> {{ ps.sessionvalue }} </td>
|
||||
<td> {{ actualvalue|lookup:ps.id }}</td>
|
||||
<td> {{ ps.sessionunit }} </td>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<a href="/rowers/sessions/{{ psdict.id.1 }}/togarmin/?next={{ request.path|urlencode }}"><i class="fas fa-watch-fitness fa-fw"></i> Export to Garmin</a>
|
||||
{% endif %}
|
||||
{% if plannedsession.intervals_icu_id %}
|
||||
<a href="https://intervals.icu/?w={{ plannedsession.preferreddate }}"><i class="fa-solid fa-wave-pulse"></i> Exported to intervals.icu</a>
|
||||
<a href="https://intervals.icu/?w={{ plannedsession.preferreddate }}"><i class="fa-kit fa-solid-wave-pulse-circle-check"></i> Exported to intervals.icu</a>
|
||||
{% else %}
|
||||
<a href="/rowers/sessions/{{ psdict.id.1 }}/tointervals/?next={{ request.path|urlencode }}"><i class="fa-solid fa-wave-pulse fa-fw"></i> Export to intervals.icu</a>
|
||||
{% endif %}
|
||||
|
||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
@@ -1564,6 +1564,9 @@ def virtualevent_mapcompare_view(request, id=0):
|
||||
|
||||
def course_compare_view(request, id=0):
|
||||
results = []
|
||||
xparam = 'distance'
|
||||
yparam = 'pace'
|
||||
plottype = 'line'
|
||||
|
||||
promember = 0
|
||||
if not request.user.is_anonymous:
|
||||
|
||||
Reference in New Issue
Block a user