Merge branch 'release/v23.5.4'
This commit is contained in:
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
sander@rowsandall-2.14384:1749892836
|
||||||
+27
-1
@@ -266,7 +266,29 @@ class WorkoutNameTemplateField(models.TextField):
|
|||||||
value = self._get_val_from_obj(obj)
|
value = self._get_val_from_obj(obj)
|
||||||
return self.get_deb_prep_value(value)
|
return self.get_deb_prep_value(value)
|
||||||
|
|
||||||
|
|
||||||
|
class WorkoutChartStackFavoriteField(models.TextField):
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super(WorkoutChartStackFavoriteField, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
def to_python(self, value): # pragma: no cover
|
||||||
|
if not value:
|
||||||
|
return
|
||||||
|
return json.loads(value)
|
||||||
|
|
||||||
|
def from_db_value(self, value, expression, connection):
|
||||||
|
if not value:
|
||||||
|
return
|
||||||
|
return json.loads(value)
|
||||||
|
|
||||||
|
def get_db_prep_value(self, value, connection, prepared=False):
|
||||||
|
if not value:
|
||||||
|
return
|
||||||
|
return json.dumps(value)
|
||||||
|
|
||||||
|
def value_to_string(self, obj): # pragma: no cover
|
||||||
|
value = self._get_val_from_obj(obj)
|
||||||
|
return self.get_deb_prep_value(value)
|
||||||
|
|
||||||
# model for Planned Session Steps
|
# model for Planned Session Steps
|
||||||
|
|
||||||
@@ -1177,6 +1199,10 @@ class Rower(models.Model):
|
|||||||
verbose_name="Title link on workout list")
|
verbose_name="Title link on workout list")
|
||||||
|
|
||||||
workoutnametemplate = WorkoutNameTemplateField(default=['date','name','distance','ownerfirst','ownerlast','duration','boattype','workouttype'])
|
workoutnametemplate = WorkoutNameTemplateField(default=['date','name','distance','ownerfirst','ownerlast','duration','boattype','workouttype'])
|
||||||
|
chartstacktemplate_x = models.CharField(default='time',verbose_name='X-Axis for Chart Stacked View',max_length=200,
|
||||||
|
choices=(('time', 'Time'),('distance', 'Distance')),)
|
||||||
|
chartstacktemplate_y = WorkoutChartStackFavoriteField(default=['pace','power','hr','spm'],
|
||||||
|
verbose_name='Y-Axis for Chart Stacked View',)
|
||||||
|
|
||||||
# Access tokens
|
# Access tokens
|
||||||
training_plan_code = models.CharField(default='', max_length=200, blank=True, null=True)
|
training_plan_code = models.CharField(default='', max_length=200, blank=True, null=True)
|
||||||
|
|||||||
@@ -64,7 +64,10 @@ def add_workout_from_data(userid, nkid, data, strokedata, source='nk', splitdata
|
|||||||
totalDistance = totalDistanceImp
|
totalDistance = totalDistanceImp
|
||||||
useImpeller = True
|
useImpeller = True
|
||||||
|
|
||||||
summary = get_nk_allstats(data, strokedata)
|
try:
|
||||||
|
summary = get_nk_allstats(data, strokedata)
|
||||||
|
except Exception: # pragma: no cover
|
||||||
|
summary = "error generating summary\n"
|
||||||
|
|
||||||
speedInput = data['speedInput'] # 0 = GPS; 1 = Impeller
|
speedInput = data['speedInput'] # 0 = GPS; 1 = Impeller
|
||||||
|
|
||||||
|
|||||||
@@ -1128,7 +1128,7 @@ def create_next_week_from_json(plansteps, rower, planbyrscore=False, plan=None,
|
|||||||
startdate=timezone.now()-timezone.timedelta(days=timezone.now().weekday())+timezone.timedelta(days=7)):
|
startdate=timezone.now()-timezone.timedelta(days=timezone.now().weekday())+timezone.timedelta(days=7)):
|
||||||
trainingdays = plansteps['cycles']
|
trainingdays = plansteps['cycles']
|
||||||
# start date is the first day of the following week
|
# start date is the first day of the following week
|
||||||
|
|
||||||
ndays = 0
|
ndays = 0
|
||||||
for day in trainingdays:
|
for day in trainingdays:
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -41,6 +41,19 @@
|
|||||||
</form>
|
</form>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Use this form to change the default axes for the stacked workout chart.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<table with=100%>
|
||||||
|
{{ stackedchartform.as_table }}
|
||||||
|
</table>
|
||||||
|
<input type="submit" value="Save" class="button"/>
|
||||||
|
</form>
|
||||||
|
</p>
|
||||||
|
|
||||||
<h1>Workout Name Settings of {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
<h1>Workout Name Settings of {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@@ -47,6 +47,13 @@
|
|||||||
<input name="chartform" type="submit"
|
<input name="chartform" type="submit"
|
||||||
value="Update Chart">
|
value="Update Chart">
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
<input name="save" value="Update Chart and Save Preferred Metrics"
|
||||||
|
type="submit">
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
(This saves your preferred X and Y axes for all workouts.)
|
||||||
|
</p>
|
||||||
</form>
|
</form>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
BIN
Binary file not shown.
@@ -960,7 +960,12 @@ def rower_register_view(request):
|
|||||||
email = EmailMessage(
|
email = EmailMessage(
|
||||||
mail_subject, message, to=[to_email]
|
mail_subject, message, to=[to_email]
|
||||||
)
|
)
|
||||||
email.send()
|
try:
|
||||||
|
email.send()
|
||||||
|
except Exception as e:
|
||||||
|
# send through alternative email server
|
||||||
|
pass
|
||||||
|
|
||||||
return render(request, 'confirmemailpage.html', {'address': to_email})
|
return render(request, 'confirmemailpage.html', {'address': to_email})
|
||||||
|
|
||||||
# login(request,theuser)
|
# login(request,theuser)
|
||||||
|
|||||||
@@ -250,6 +250,27 @@ def rower_favoritecharts_view(request, userid=0):
|
|||||||
staticchartform = StaticChartRowerForm(instance=r)
|
staticchartform = StaticChartRowerForm(instance=r)
|
||||||
datasettingsform = DataRowerForm(instance=r)
|
datasettingsform = DataRowerForm(instance=r)
|
||||||
|
|
||||||
|
xparam = 'time'
|
||||||
|
yparam1 = 'pace'
|
||||||
|
yparam2 = 'power'
|
||||||
|
yparam3 = 'hr'
|
||||||
|
yparam4 = 'spm'
|
||||||
|
|
||||||
|
xparam = r.chartstacktemplate_x
|
||||||
|
yparam1 = r.chartstacktemplate_y[0]
|
||||||
|
yparam2 = r.chartstacktemplate_y[1]
|
||||||
|
yparam3 = r.chartstacktemplate_y[2]
|
||||||
|
yparam4 = r.chartstacktemplate_y[3]
|
||||||
|
|
||||||
|
initial = {
|
||||||
|
'xaxis': xparam,
|
||||||
|
'yaxis1': yparam1,
|
||||||
|
'yaxis2': yparam2,
|
||||||
|
'yaxis3': yparam3,
|
||||||
|
'yaxis4': yparam4,
|
||||||
|
}
|
||||||
|
stackedchartform = StravaChartForm(request, initial=initial)
|
||||||
|
|
||||||
favorites = FavoriteChart.objects.filter(user=r).order_by('id')
|
favorites = FavoriteChart.objects.filter(user=r).order_by('id')
|
||||||
aantal = len(favorites)
|
aantal = len(favorites)
|
||||||
favorites_data = [{'yparam1': f.yparam1,
|
favorites_data = [{'yparam1': f.yparam1,
|
||||||
@@ -272,6 +293,17 @@ def rower_favoritecharts_view(request, userid=0):
|
|||||||
workoutnametemplate_data = [{'element': element} for element in r.workoutnametemplate]
|
workoutnametemplate_data = [{'element': element} for element in r.workoutnametemplate]
|
||||||
workoutnametemplate_formset = WorkoutNameTemplateFormSet(initial=workoutnametemplate_data, prefix='workoutname')
|
workoutnametemplate_formset = WorkoutNameTemplateFormSet(initial=workoutnametemplate_data, prefix='workoutname')
|
||||||
|
|
||||||
|
if request.method == 'POST' and 'yaxis4' in request.POST:
|
||||||
|
stackedchartform = StravaChartForm(request, request.POST)
|
||||||
|
if stackedchartform.is_valid():
|
||||||
|
r.chartstacktemplate_x = stackedchartform.cleaned_data.get('xaxis')
|
||||||
|
r.chartstacktemplate_y = [stackedchartform.cleaned_data.get('yaxis1'),
|
||||||
|
stackedchartform.cleaned_data.get('yaxis2'),
|
||||||
|
stackedchartform.cleaned_data.get('yaxis3'),
|
||||||
|
stackedchartform.cleaned_data.get('yaxis4')]
|
||||||
|
r.save()
|
||||||
|
messages.info(request, "We have updated your stacked chart settings")
|
||||||
|
|
||||||
if request.method == 'POST' and 'workoutname-TOTAL_FORMS' in request.POST:
|
if request.method == 'POST' and 'workoutname-TOTAL_FORMS' in request.POST:
|
||||||
if 'defaults_workoutname' in request.POST:
|
if 'defaults_workoutname' in request.POST:
|
||||||
r.workoutnametemplate = ['date','name','distance','ownerfirst','ownerlast','duration','boattype','workouttype']
|
r.workoutnametemplate = ['date','name','distance','ownerfirst','ownerlast','duration','boattype','workouttype']
|
||||||
@@ -371,6 +403,7 @@ def rower_favoritecharts_view(request, userid=0):
|
|||||||
'favorites_formset': favorites_formset,
|
'favorites_formset': favorites_formset,
|
||||||
'teams': get_my_teams(request.user),
|
'teams': get_my_teams(request.user),
|
||||||
'rower': r,
|
'rower': r,
|
||||||
|
'stackedchartform': stackedchartform,
|
||||||
'staticchartform': staticchartform,
|
'staticchartform': staticchartform,
|
||||||
'datasettingsform': datasettingsform,
|
'datasettingsform': datasettingsform,
|
||||||
'workoutnametemplate_formset': workoutnametemplate_formset,
|
'workoutnametemplate_formset': workoutnametemplate_formset,
|
||||||
|
|||||||
@@ -4240,6 +4240,12 @@ def workout_flexchart_stacked_view(request, *args, **kwargs):
|
|||||||
yparam3 = 'hr'
|
yparam3 = 'hr'
|
||||||
yparam4 = 'spm'
|
yparam4 = 'spm'
|
||||||
|
|
||||||
|
xparam = r.chartstacktemplate_x
|
||||||
|
yparam1 = r.chartstacktemplate_y[0]
|
||||||
|
yparam2 = r.chartstacktemplate_y[1]
|
||||||
|
yparam3 = r.chartstacktemplate_y[2]
|
||||||
|
yparam4 = r.chartstacktemplate_y[3]
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
flexaxesform = StravaChartForm(request, request.POST)
|
flexaxesform = StravaChartForm(request, request.POST)
|
||||||
if flexaxesform.is_valid():
|
if flexaxesform.is_valid():
|
||||||
@@ -4250,6 +4256,11 @@ def workout_flexchart_stacked_view(request, *args, **kwargs):
|
|||||||
yparam3 = cd['yaxis3']
|
yparam3 = cd['yaxis3']
|
||||||
yparam4 = cd['yaxis4']
|
yparam4 = cd['yaxis4']
|
||||||
|
|
||||||
|
if 'save' in request.POST:
|
||||||
|
r.chartstacktemplate_x = xparam
|
||||||
|
r.chartstacktemplate_y = [yparam1, yparam2, yparam3, yparam4]
|
||||||
|
r.save()
|
||||||
|
|
||||||
(
|
(
|
||||||
script, div
|
script, div
|
||||||
) = interactive_flexchart_stacked(
|
) = interactive_flexchart_stacked(
|
||||||
|
|||||||
Reference in New Issue
Block a user