Private
Public Access
1
0

fixes and additions

This commit is contained in:
2024-12-27 11:04:27 +01:00
parent c601af31c5
commit bc4c047ba0
5 changed files with 55 additions and 32 deletions

View File

@@ -109,7 +109,7 @@ import pyarrow as pa
from pyarrow.lib import ArrowInvalid 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.utils.timezone import get_current_timezone
from django.urls import reverse from django.urls import reverse
import requests import requests
@@ -276,7 +276,7 @@ def check_marker(workout):
def workout_summary_to_df( def workout_summary_to_df(
rower, rower,
startdate=datetime.datetime(1970, 1, 1), startdate=datetime.datetime(1970, 1, 1),
enddate=timezone.now()+timezone.timedelta(days=1)): enddate=tz.now()+tz.timedelta(days=1)):
ws = Workout.objects.filter( ws = Workout.objects.filter(
user=rower, date__gte=startdate, date__lte=enddate, 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): 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( workouts = Workout.objects.filter(
date__gte=firstdate, date__gte=firstdate,
workouttype__in=types, workouttype__in=types,
@@ -702,7 +702,7 @@ def join_workouts(r, ids, title='Joined Workout',
notes = '' notes = ''
summary = '' summary = ''
makeprivate = False makeprivate = False
startdatetime = timezone.now() startdatetime = tz.now()
if setprivate is True and makeprivate is False: # pragma: no cover if setprivate is True and makeprivate is False: # pragma: no cover
makeprivate = True makeprivate = True
@@ -801,7 +801,7 @@ def fetchcp_new(rower, workouts):
def update_rolling_cp(r, types, mode='water', dosend=False): 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( workouts = Workout.objects.filter(
date__gte=firstdate, date__gte=firstdate,
workouttype__in=types, workouttype__in=types,
@@ -1425,10 +1425,12 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
w.save() w.save()
except ValidationError: # pragma: no cover except ValidationError: # pragma: no cover
try: try:
w.startdatetime = timezone.now() w.startdatetime = tz.now()
w.save() w.save()
except ValidationError: except ValidationError:
return (0, 'Unable to create your workout') return (0, 'Unable to create your workout')
except AttributeError:
return (0, 'Unable to create your workout')
if privacy == 'visible': if privacy == 'visible':
ts = Team.objects.filter(rower=r) ts = Team.objects.filter(rower=r)
@@ -1631,28 +1633,32 @@ def new_workout_from_file(r, f2,
startdatetime=startdatetime, startdatetime=startdatetime,
)) ))
id, message = save_workout_database( try:
f2, r, id, message = save_workout_database(
notes=notes, f2, r,
workouttype=workouttype, notes=notes,
weightcategory=r.weightcategory, workouttype=workouttype,
adaptiveclass=r.adaptiveclass, weightcategory=r.weightcategory,
boattype=boattype, adaptiveclass=r.adaptiveclass,
makeprivate=makeprivate, boattype=boattype,
dosummary=dosummary, makeprivate=makeprivate,
workoutsource=workoutsource, dosummary=dosummary,
summary=summary, workoutsource=workoutsource,
startdatetime=startdatetime, summary=summary,
timezone=timezone, startdatetime=startdatetime,
rpe=rpe, timezone=timezone,
inboard=inboard, oarlength=oarlength, rpe=rpe,
seatnumber=seatnumber, boatname=boatname, inboard=inboard, oarlength=oarlength,
empowerside=empowerside, seatnumber=seatnumber, boatname=boatname,
title=title, empowerside=empowerside,
forceunit='N', title=title,
impeller=impeller, forceunit='N',
workoutid=workoutid, impeller=impeller,
) workoutid=workoutid,
)
except ValueError:
message = "error saving"
id = 0
return (id, message, f2) return (id, message, f2)
@@ -1696,7 +1702,7 @@ def new_workout_from_df(r, df,
makeprivate = False makeprivate = False
rpe = 0 rpe = 0
if startdatetime == '': # pragma: no cover if startdatetime == '': # pragma: no cover
startdatetime = timezone.now() startdatetime = tz.now()
if setprivate: # pragma: no cover if setprivate: # pragma: no cover
makeprivate = True makeprivate = True

View File

@@ -56,6 +56,9 @@
<th align="left">Edit</th> <th align="left">Edit</th>
<th align="left">Clone</th> <th align="left">Clone</th>
<th align="left">Delete</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">Planned</th>
<th align="left">Actual</th> <th align="left">Actual</th>
<th align="left">&nbsp;</th> <th align="left">&nbsp;</th>
@@ -119,15 +122,26 @@
&nbsp; &nbsp;
{% endif %} {% endif %}
</td> </td>
<td> <td>
{% if ps.manager == request.user %} {% if ps.manager == request.user %}
<a class="small" <a class="small"
href="/rowers/sessions/{{ ps.id }}/deleteconfirm"><i class="fas fa-trash-alt fa-fw"></i></a> href="/rowers/sessions/{{ ps.id }}/deleteconfirm"><i class="fas fa-trash-alt fa-fw"></i></a>
{% else %} {% else %}
<a class="small" <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 %} {% endif %}
</td> </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> {{ ps.sessionvalue }} </td>
<td> {{ actualvalue|lookup:ps.id }}</td> <td> {{ actualvalue|lookup:ps.id }}</td>
<td> {{ ps.sessionunit }} </td> <td> {{ ps.sessionunit }} </td>

View File

@@ -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> <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 %} {% endif %}
{% if plannedsession.intervals_icu_id %} {% 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 %} {% 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> <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 %} {% endif %}

Binary file not shown.

View File

@@ -1564,6 +1564,9 @@ def virtualevent_mapcompare_view(request, id=0):
def course_compare_view(request, id=0): def course_compare_view(request, id=0):
results = [] results = []
xparam = 'distance'
yparam = 'pace'
plottype = 'line'
promember = 0 promember = 0
if not request.user.is_anonymous: if not request.user.is_anonymous: