Merge pull request #248 from jat255/virtual_ride

Add new Virtual Cycling sport
This commit is contained in:
Sam 2022-10-31 08:54:00 +01:00 committed by GitHub
commit bcbda9a697
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 95 additions and 10 deletions

View File

@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/favicon.ico"><![endif]--><link rel="stylesheet" href="/static/css/fork-awesome.min.css"/><link rel="stylesheet" href="/static/css/leaflet.css"/><title>FitTrackee</title><script defer="defer" src="/static/js/chunk-vendors.e9c5b3a5.js"></script><script defer="defer" src="/static/js/app.fd9b98d6.js"></script><link href="/static/css/app.eee1934d.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png"><link rel="manifest" href="/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="fittrackee_client"><link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but FitTrackee doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/favicon.ico"><![endif]--><link rel="stylesheet" href="/static/css/fork-awesome.min.css"/><link rel="stylesheet" href="/static/css/leaflet.css"/><title>FitTrackee</title><script defer="defer" src="/static/js/chunk-vendors.e9c5b3a5.js"></script><script defer="defer" src="/static/js/app.f492102f.js"></script><link href="/static/css/app.eee1934d.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png"><link rel="manifest" href="/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="fittrackee_client"><link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but FitTrackee doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
"use strict";(self["webpackChunkfittrackee_client"]=self["webpackChunkfittrackee_client"]||[]).push([[193],{7885:function(e,s,t){t.r(s),t.d(s,{default:function(){return A}});var a=t(6252),r=t(2262),l=t(3577),o=(t(7658),t(9150)),n=t(4998);const c={class:"chart-menu"},i={class:"chart-arrow"},u={class:"time-frames custom-checkboxes-group"},d={class:"time-frames-checkboxes custom-checkboxes"},p=["id","name","checked","onInput"],m={class:"chart-arrow"};var v=(0,a.aZ)({__name:"StatsMenu",emits:["arrowClick","timeFrameUpdate"],setup(e,{emit:s}){const t=(0,r.iH)("month"),o=["week","month","year"];function n(e){t.value=e,s("timeFrameUpdate",e)}return(e,r)=>((0,a.wg)(),(0,a.iD)("div",c,[(0,a._)("div",i,[(0,a._)("i",{class:"fa fa-chevron-left","aria-hidden":"true",onClick:r[0]||(r[0]=e=>s("arrowClick",!0))})]),(0,a._)("div",u,[(0,a._)("div",d,[((0,a.wg)(),(0,a.iD)(a.HY,null,(0,a.Ko)(o,(s=>(0,a._)("div",{class:"time-frame custom-checkbox",key:s},[(0,a._)("label",null,[(0,a._)("input",{type:"radio",id:s,name:s,checked:t.value===s,onInput:e=>n(s)},null,40,p),(0,a._)("span",null,(0,l.zw)(e.$t(`statistics.TIME_FRAMES.${s}`)),1)])]))),64))])]),(0,a._)("div",m,[(0,a._)("i",{class:"fa fa-chevron-right","aria-hidden":"true",onClick:r[1]||(r[1]=e=>s("arrowClick",!1))})])]))}}),k=t(3744);const _=(0,k.Z)(v,[["__scopeId","data-v-22d55de2"]]);var S=_,w=t(631);const f={class:"sports-menu"},h=["id","name","checked","onInput"],U={class:"sport-label"};var b=(0,a.aZ)({__name:"StatsSportsMenu",props:{userSports:null,selectedSportIds:{default:()=>[]}},emits:["selectedSportIdsUpdate"],setup(e,{emit:s}){const t=e,{t:n}=(0,o.QT)(),c=(0,a.f3)("sportColors"),{selectedSportIds:i}=(0,r.BK)(t),u=(0,a.Fl)((()=>(0,w.xH)(t.userSports,n)));function d(e){s("selectedSportIdsUpdate",e)}return(e,s)=>{const t=(0,a.up)("SportImage");return(0,a.wg)(),(0,a.iD)("div",f,[((0,a.wg)(!0),(0,a.iD)(a.HY,null,(0,a.Ko)((0,r.SU)(u),(e=>((0,a.wg)(),(0,a.iD)("label",{type:"checkbox",key:e.id,style:(0,l.j5)({color:e.color?e.color:(0,r.SU)(c)[e.label]})},[(0,a._)("input",{type:"checkbox",id:e.id,name:e.label,checked:(0,r.SU)(i).includes(e.id),onInput:s=>d(e.id)},null,40,h),(0,a.Wm)(t,{"sport-label":e.label,color:e.color},null,8,["sport-label","color"]),(0,a._)("span",U,(0,l.zw)(e.translatedLabel),1)],4)))),128))])}}});const I=b;var g=I,T=t(9318);const y={key:0,id:"user-statistics"};var C=(0,a.aZ)({__name:"index",props:{sports:null,user:null},setup(e){const s=e,{t:t}=(0,o.QT)(),{sports:l,user:c}=(0,r.BK)(s),i=(0,r.iH)("month"),u=(0,r.iH)(v(i.value)),d=(0,a.Fl)((()=>(0,w.xH)(s.sports,t))),p=(0,r.iH)(_(s.sports));function m(e){i.value=e,u.value=v(i.value)}function v(e){return(0,T.aZ)(new Date,e,s.user.weekm)}function k(e){u.value=(0,T.FN)(u.value,e,s.user.weekm)}function _(e){return e.map((e=>e.id))}function f(e){p.value.includes(e)?p.value=p.value.filter((s=>s!==e)):p.value.push(e)}return(0,a.YP)((()=>s.sports),(e=>{p.value=_(e)})),(e,s)=>(0,r.SU)(d)?((0,a.wg)(),(0,a.iD)("div",y,[(0,a.Wm)(S,{onTimeFrameUpdate:m,onArrowClick:k}),(0,a.Wm)(n.Z,{sports:(0,r.SU)(l),user:(0,r.SU)(c),chartParams:u.value,"displayed-sport-ids":p.value,fullStats:!0},null,8,["sports","user","chartParams","displayed-sport-ids"]),(0,a.Wm)(g,{"selected-sport-ids":p.value,"user-sports":(0,r.SU)(l),onSelectedSportIdsUpdate:f},null,8,["selected-sport-ids","user-sports"])])):(0,a.kq)("",!0)}});const F=(0,k.Z)(C,[["__scopeId","data-v-30799d13"]]);var Z=F,x=t(5630),D=t(5801),H=t(9917);const E={id:"statistics",class:"view"},R={key:0,class:"container"};var W=(0,a.aZ)({__name:"StatisticsView",setup(e){const s=(0,H.o)(),t=(0,a.Fl)((()=>s.getters[D.YN.GETTERS.AUTH_USER_PROFILE])),o=(0,a.Fl)((()=>s.getters[D.O8.GETTERS.SPORTS].filter((e=>t.value.sports_list.includes(e.id)))));return(e,s)=>{const n=(0,a.up)("Card");return(0,a.wg)(),(0,a.iD)("div",E,[(0,r.SU)(t).username?((0,a.wg)(),(0,a.iD)("div",R,[(0,a.Wm)(n,null,{title:(0,a.w5)((()=>[(0,a.Uk)((0,l.zw)(e.$t("statistics.STATISTICS")),1)])),content:(0,a.w5)((()=>[(0,a.Wm)(Z,{class:(0,l.C_)({"stats-disabled":0===(0,r.SU)(t).nb_workouts}),user:(0,r.SU)(t),sports:(0,r.SU)(o)},null,8,["class","user","sports"])])),_:1}),0===(0,r.SU)(t).nb_workouts?((0,a.wg)(),(0,a.j4)(x.Z,{key:0})):(0,a.kq)("",!0)])):(0,a.kq)("",!0)])}}});const P=(0,k.Z)(W,[["__scopeId","data-v-2e341d4e"]]);var A=P}}]);
//# sourceMappingURL=statistics.61163b0e.js.map
//# sourceMappingURL=statistics.9cd652fd.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,34 @@
"""add virtual cycling as sport type
Revision ID: 5b936821326d
Revises: 84d840ce853b
Create Date: 2022-10-26 17:43:20.114104
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '5b936821326d'
down_revision = '84d840ce853b'
branch_labels = None
depends_on = None
def upgrade():
op.execute(
"""
INSERT INTO sports (label, is_active, stopped_speed_threshold)
VALUES ('Cycling (Virtual)', True, 1)
"""
)
def downgrade():
op.execute(
"""
DELETE FROM sports
WHERE label = 'Cycling (Virtual)';
"""
)

View File

@ -0,0 +1,39 @@
<template>
<svg
version="1.1"
id="Capa_1"
x="0px"
y="0px"
viewBox="0 0 491.737 491.737"
style="enable-background: new 0 0 491.737 491.737"
xml:space="preserve"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<desc
id="cyclingVirtualDescription">
silhouette of a person riding a bicycle with virtual indicator
</desc>
<path
d="m 321.097,112.359 c 20.973,12.338 47.985,5.315 60.293,-15.652 12.34,-20.973 5.35,-47.974 -15.623,-60.304 -21.009,-12.332 -47.99,-5.317 -60.314,15.65 -12.324,20.983 -5.35,47.974 15.644,60.306 z"
id="path3" /><path
d="m 393.081,264.102 c -2.414,0 -4.8,0.194 -7.169,0.362 l -14.431,-71.605 4.702,-1.757 c 10.666,-3.987 16.093,-15.868 12.098,-26.54 -3.994,-10.681 -15.946,-16.084 -26.531,-12.09 l -51.823,19.38 -2.321,-18.864 c 6.3,-13.193 5.541,-29.78 -4.767,-41.482 -21.224,-24.092 -47.12,-12.508 -55.191,-5.976 l -106.884,86.555 0.016,0.024 c -3.319,2.893 -6.089,6.485 -7.86,10.842 -2.191,5.396 -2.596,11.067 -1.564,16.384 -8.503,0.669 -15.255,7.571 -15.255,16.246 0,9.085 7.346,16.44 16.432,16.48 l -6.797,15.906 c -8.62,-2.465 -17.674,-3.866 -27.066,-3.866 C 44.27,264.102 0,308.354 0,362.754 c 0,54.403 44.27,98.663 98.668,98.663 54.403,0 98.652,-44.26 98.652,-98.663 0,-36.228 -19.683,-67.867 -48.858,-85.024 l 10.957,-25.652 h 17.767 l 60.281,24.462 -32.201,52.773 c -8.297,13.612 -3.994,31.382 9.615,39.685 4.691,2.86 9.878,4.229 15,4.229 9.729,0 19.234,-4.929 24.677,-13.838 l 29.339,-48.095 19.072,11.511 c -5.447,12.227 -8.54,25.726 -8.54,39.95 0,54.403 44.254,98.663 98.652,98.663 54.402,0 98.656,-44.26 98.656,-98.663 0,-54.401 -44.254,-98.653 -98.656,-98.653 z M 98.668,436.671 c -40.756,0 -73.923,-33.161 -73.923,-73.917 0,-40.756 33.167,-73.909 73.923,-73.909 5.944,0 11.649,0.896 17.188,2.224 L 95.38,338.962 c -11.758,1.619 -20.843,11.598 -20.843,23.792 0,13.323 10.808,24.132 24.13,24.132 8.767,0 16.367,-4.745 20.589,-11.76 h 52.065 c -5.926,34.862 -36.133,61.545 -72.653,61.545 z m 72.654,-86.288 h -52.065 c -0.355,-0.588 -0.708,-1.176 -1.112,-1.732 l 20.476,-47.901 c 17.058,11.026 29.172,28.845 32.701,49.633 z m 125.459,-60.208 7.666,-12.564 c 4.416,-7.233 5.431,-16.038 2.774,-24.084 -2.661,-8.046 -8.718,-14.515 -16.562,-17.704 l -52.725,-21.395 32.443,-26.281 1.804,14.691 c 0.756,6.267 4.366,11.841 9.761,15.12 3.271,1.981 6.979,2.988 10.698,2.988 2.435,0 4.88,-0.435 7.218,-1.306 l 48.15,-18.001 13.627,67.691 c -18.268,6.162 -34.117,17.51 -45.848,32.314 z m 78.615,47.458 -38.003,-22.94 c 7.877,-9.118 17.787,-16.319 29.205,-20.734 z m 17.685,99.038 c -40.757,0 -73.907,-33.161 -73.907,-73.917 0,-9.544 1.965,-18.597 5.268,-26.983 l 44.541,26.888 c 0,0.032 -0.016,0.064 -0.016,0.095 0,13.323 10.808,24.132 24.114,24.132 13.322,0 24.118,-10.81 24.118,-24.132 0,-10.478 -6.721,-19.307 -16.06,-22.64 l -10.277,-51.043 c 0.756,-0.024 1.463,-0.226 2.22,-0.226 40.757,0 73.911,33.153 73.911,73.909 -10e-4,40.756 -33.155,73.917 -73.912,73.917 z"
id="path5" />
<g
id="g10174"
transform="rotate(-45,60.058765,120.50397)"><path
d="m 100.16593,30.670651 c -5.521751,5.521749 -5.521751,14.11256 0,19.638597 17.79324,17.793301 28.22948,42.342094 28.22948,67.502302 0,25.77277 -9.81917,49.70354 -27.61257,67.50231 -5.521761,5.52175 -5.521761,14.11256 0,19.63859 2.45267,2.45269 6.13811,4.29754 9.81916,4.29754 3.68106,0 7.36234,-1.22848 9.81921,-4.29754 23.31927,-23.31932 36.20348,-54.00119 36.20348,-87.1365 0,-33.134258 -12.88856,-63.816092 -36.20348,-87.136525 -6.14243,-5.530298 -14.73279,-5.530298 -20.25443,-0.0085 z"
id="path3370"
style="stroke-width:1.09578" /><path
d="m 83.597679,66.875252 c -5.52175,-5.521722 -14.11255,-5.521722 -19.63857,0 -5.52175,5.521756 -5.52175,14.11259 0,19.6386 8.59071,8.5907 12.88856,19.638598 12.88856,31.294418 0,11.66021 -4.90967,23.31931 -12.88856,31.29441 -5.52175,5.52175 -5.52175,14.11256 0,19.63859 2.45267,2.45269 6.13812,4.29754 9.81917,4.29754 3.68105,0 7.36233,-1.22847 9.81917,-4.29754 13.50002,-13.50004 21.479501,-31.91025 20.862591,-50.93191 0.61209,-19.026028 -6.750211,-37.431868 -20.862591,-50.93189 z"
id="path3372"
style="stroke-width:1.09578" /><path
d="m 54.143079,118.42081 c 0,11.86074 -9.61798,21.47512 -21.4795,21.47512 -11.861488,0 -21.4795,-9.61372 -21.4795,-21.47512 0,-11.86141 9.618012,-21.479498 21.4795,-21.479498 11.86152,0 21.4795,9.618008 21.4795,21.479498"
id="path3378"
style="stroke-width:1.09578" /></g></svg>
</template>
<script>
export default {
name: 'CyclingVirtual',
}
</script>

View File

@ -6,6 +6,7 @@
>
<CyclingSport v-if="sportLabel === 'Cycling (Sport)'" />
<CyclingTransport v-if="sportLabel === 'Cycling (Transport)'" />
<CyclingVirtual v-if="sportLabel === 'Cycling (Virtual)'" />
<Hiking v-if="sportLabel === 'Hiking'" />
<MountainBiking v-if="sportLabel === 'Mountain Biking'" />
<MountainBikingElectric
@ -26,6 +27,7 @@
import CyclingSport from '@/components/Common/Images/SportImage/CyclingSport.vue'
import CyclingTransport from '@/components/Common/Images/SportImage/CyclingTransport.vue'
import CyclingVirtual from '@/components/Common/Images/SportImage/CyclingVirtual.vue'
import Hiking from '@/components/Common/Images/SportImage/Hiking.vue'
import MountainBiking from '@/components/Common/Images/SportImage/MountainBiking.vue'
import MountainBikingElectric from '@/components/Common/Images/SportImage/MountainBikingElectric.vue'

View File

@ -5,6 +5,9 @@
"Cycling (Transport)": {
"LABEL": "Radfahren (Pendeln)"
},
"Cycling (Virtual)": {
"LABEL": "Radfahren (Virtuell)"
},
"Hiking": {
"LABEL": "Wandern"
},

View File

@ -5,6 +5,9 @@
"Cycling (Transport)": {
"LABEL": "Cycling (Transport)"
},
"Cycling (Virtual)": {
"LABEL": "Cycling (Virtual)"
},
"Hiking": {
"LABEL": "Hiking"
},

View File

@ -5,6 +5,9 @@
"Cycling (Transport)": {
"LABEL": "Vélo (Transport)"
},
"Cycling (Virtual)": {
"LABEL": "Vélo (Virtuel)"
},
"Hiking": {
"LABEL": "Randonnée"
},

View File

@ -4,6 +4,7 @@ import { IWorkout } from '@/types/workouts'
export const sportColors: Record<string, string> = {
'Cycling (Sport)': '#4c9792',
'Cycling (Transport)': '#88af98',
'Cycling (Virtual)': '#64a360',
Hiking: '#bb757c',
'Mountain Biking': '#d4b371',
'Mountain Biking (Electric)': '#fc9d6f',