Client - minor fixes

This commit is contained in:
Sam 2022-08-27 19:23:01 +02:00
parent 59940ed41d
commit 9ed142e100
4 changed files with 11 additions and 5 deletions

View File

@ -66,7 +66,7 @@
function getQuery( function getQuery(
page: number, page: number,
cursor?: number cursor?: number
): TWorkoutsPayload | TPaginationPayload { ): TPaginationPayload | IOauth2ClientsPayload {
const newQuery = Object.assign({}, query.value) const newQuery = Object.assign({}, query.value)
newQuery.page = cursor ? page + cursor : page newQuery.page = cursor ? page + cursor : page
return newQuery return newQuery

View File

@ -28,13 +28,13 @@
import SportsMenu from '@/components/Statistics/StatsSportsMenu.vue' import SportsMenu from '@/components/Statistics/StatsSportsMenu.vue'
import { ISport, ITranslatedSport } from '@/types/sports' import { ISport, ITranslatedSport } from '@/types/sports'
import { IStatisticsDateParams } from '@/types/statistics' import { IStatisticsDateParams } from '@/types/statistics'
import { IUserProfile } from '@/types/user' import { IAuthUserProfile } from '@/types/user'
import { translateSports } from '@/utils/sports' import { translateSports } from '@/utils/sports'
import { getStatsDateParams, updateChartParams } from '@/utils/statistics' import { getStatsDateParams, updateChartParams } from '@/utils/statistics'
interface Props { interface Props {
sports: ISport[] sports: ISport[]
user: IUserProfile user: IAuthUserProfile
} }
const props = defineProps<Props>() const props = defineProps<Props>()

View File

@ -184,7 +184,8 @@
const { t } = useI18n() const { t } = useI18n()
const { isEdition, user } = toRefs(props) const { isEdition, user } = toRefs(props)
const sportColors = inject('sportColors') const defaultColor = '#838383'
const sportColors: Record<string, string> | undefined = inject('sportColors')
const sports: ComputedRef<ISport[]> = computed( const sports: ComputedRef<ISport[]> = computed(
() => store.getters[SPORTS_STORE.GETTERS.SPORTS] () => store.getters[SPORTS_STORE.GETTERS.SPORTS]
) )
@ -207,7 +208,11 @@
function updateSportInEdition(sport: ISport | null) { function updateSportInEdition(sport: ISport | null) {
if (sport !== null) { if (sport !== null) {
sportPayload.sport_id = sport.id sportPayload.sport_id = sport.id
sportPayload.color = sport.color ? sport.color : sportColors[sport.label] sportPayload.color = sport.color
? sport.color
: sportColors
? sportColors[sport.label]
: defaultColor
sportPayload.is_active = sport.is_active_for_user sportPayload.is_active = sport.is_active_for_user
sportPayload.stopped_speed_threshold = sport.stopped_speed_threshold sportPayload.stopped_speed_threshold = sport.stopped_speed_threshold
} else { } else {

View File

@ -18,6 +18,7 @@ export interface IUserProfile {
picture: string | boolean picture: string | boolean
records: IRecord[] records: IRecord[]
sports_list: number[] sports_list: number[]
total_ascent: number
total_distance: number total_distance: number
total_duration: string total_duration: string
username: string username: string