diff --git a/components/forms/AscentFiltersToggleBtn.vue b/components/forms/AscentFiltersToggleBtn.vue
new file mode 100644
index 00000000..8942e81e
--- /dev/null
+++ b/components/forms/AscentFiltersToggleBtn.vue
@@ -0,0 +1,47 @@
+
+
+
+
+
+ {{ $t('models.ascentCragRoute.only_lead_climbs') }}
+
+
+ {{ $t('models.ascentCragRoute.only_on_sight') }}
+
+
+
+
+
+
+
+
+
diff --git a/components/logBooks/outdoors/LogBookList.vue b/components/logBooks/outdoors/LogBookList.vue
index 15b016ef..3a18d7a5 100644
--- a/components/logBooks/outdoors/LogBookList.vue
+++ b/components/logBooks/outdoors/LogBookList.vue
@@ -82,6 +82,10 @@ export default {
user: {
type: Object,
default: null
+ },
+ outdoorAnalytikFilters: {
+ type: Array,
+ default: () => []
}
},
@@ -121,6 +125,13 @@ export default {
}
},
+ outdoorAnalytikFilters () {
+ if (!this.firstLoading) {
+ this.resetAscents()
+ this.ascendedCragRoutes()
+ }
+ },
+
climbingType () {
if (!this.firstLoading) {
this.resetAscents()
@@ -153,7 +164,8 @@ export default {
promise = new LogBookOutdoorApi(this.$axios, this.$auth).ascendedCragRoutes(
this.order,
this.climbingType,
- this.page
+ this.page,
+ this.outdoorAnalytikFilters
)
}
diff --git a/lang/en-US.js b/lang/en-US.js
index 7f19582a..e6cd552d 100644
--- a/lang/en-US.js
+++ b/lang/en-US.js
@@ -2190,7 +2190,9 @@ export default {
comment: 'My comment',
private_comment: 'Comment is private',
released_at: 'Released at',
- hardness_status: 'Difficulty appreciation'
+ hardness_status: 'Difficulty appreciation',
+ only_lead_climbs: 'Only Lead Climbs',
+ only_on_sight: 'Only on sight'
},
ascentGymRoute: {
type: 'Type',
diff --git a/lang/fr-FR.js b/lang/fr-FR.js
index aa31482d..4d8a8571 100644
--- a/lang/fr-FR.js
+++ b/lang/fr-FR.js
@@ -2190,7 +2190,9 @@ export default {
comment: 'Mon commentaire',
private_comment: 'Commentaire privé',
released_at: 'Réalisé le',
- hardness_status: 'Appréciation de la difficulté'
+ hardness_status: 'Appréciation de la difficulté',
+ only_lead_climbs: 'Sans moulinettes',
+ only_on_sight: 'A vue'
},
ascentGymRoute: {
type: 'Type',
diff --git a/pages/home/ascents/outdoor/analytiks.vue b/pages/home/ascents/outdoor/analytiks.vue
index 2cd1b3e8..5cddc17f 100644
--- a/pages/home/ascents/outdoor/analytiks.vue
+++ b/pages/home/ascents/outdoor/analytiks.vue
@@ -1,5 +1,6 @@
+
@@ -77,10 +78,12 @@ import LogBookGradeChart from '~/components/logBooks/outdoors/LogBookGradeChart.
import LogBookYearChart from '~/components/logBooks/outdoors/LogBookYearChart.vue'
import LogBookMonthChart from '~/components/logBooks/outdoors/LogBookMonthChart.vue'
import LogBookEvolutionChart from '~/components/logBooks/outdoors/LogBookEvolutionChart.vue'
+import AscentFiltersToggleBtn from '~/components/forms/AscentFiltersToggleBtn.vue'
export default {
name: 'CurrentUserAnalytiksView',
components: {
+ AscentFiltersToggleBtn,
LogBookEvolutionChart,
LogBookMonthChart,
LogBookYearChart,
@@ -97,6 +100,8 @@ export default {
data () {
return {
+ outdoorAnalytikFilters: [],
+
loadingClimbingTypeChart: true,
climbingTypeData: [],
@@ -120,6 +125,16 @@ export default {
}
},
+ watch: {
+ outdoorAnalytikFilters () {
+ this.getClimbingTypeChart()
+ this.getGradeChart()
+ this.getYearChart()
+ this.getMonthChart()
+ this.getEvolutionChart()
+ }
+ },
+
mounted () {
this.getClimbingTypeChart()
this.getGradeChart()
@@ -132,7 +147,7 @@ export default {
getClimbingTypeChart () {
this.loadingClimbingTypeChart = true
new LogBookOutdoorApi(this.$axios, this.$auth)
- .climbingTypeChart()
+ .climbingTypeChart(this.outdoorAnalytikFilters)
.then((resp) => {
this.climbingTypeData = resp.data
})
@@ -144,7 +159,7 @@ export default {
getGradeChart () {
this.loadingGradeChart = true
new LogBookOutdoorApi(this.$axios, this.$auth)
- .gradeChart()
+ .gradeChart(this.outdoorAnalytikFilters)
.then((resp) => {
this.gradeData = resp.data
})
@@ -156,7 +171,7 @@ export default {
getYearChart () {
this.loadingYearChart = true
new LogBookOutdoorApi(this.$axios, this.$auth)
- .yearChart()
+ .yearChart(this.outdoorAnalytikFilters)
.then((resp) => {
this.yearData = resp.data
})
@@ -168,7 +183,7 @@ export default {
getMonthChart () {
this.loadingMonthChart = true
new LogBookOutdoorApi(this.$axios, this.$auth)
- .monthChart()
+ .monthChart(this.outdoorAnalytikFilters)
.then((resp) => {
this.monthData = resp.data
})
@@ -180,7 +195,7 @@ export default {
getEvolutionChart () {
this.loadingEvolutionChart = true
new LogBookOutdoorApi(this.$axios, this.$auth)
- .evolutionChart()
+ .evolutionChart(this.outdoorAnalytikFilters)
.then((resp) => {
this.evolutionData = resp.data
})
diff --git a/pages/home/ascents/outdoor/index.vue b/pages/home/ascents/outdoor/index.vue
index 6c560d65..befbcc6f 100644
--- a/pages/home/ascents/outdoor/index.vue
+++ b/pages/home/ascents/outdoor/index.vue
@@ -45,8 +45,9 @@
class="mt-3"
>
+
-
+
@@ -63,11 +64,13 @@ import LogBookClimbingTypeChart from '~/components/logBooks/outdoors/LogBookClim
import LogBookGradeChart from '~/components/logBooks/outdoors/LogBookGradeChart.vue'
import LogBookList from '~/components/logBooks/outdoors/LogBookList.vue'
import ClimbingTypeLegend from '~/components/ui/ClimbingTypeLegend.vue'
+import AscentFiltersToggleBtn from '~/components/forms/AscentFiltersToggleBtn.vue'
const CragRouteDrawer = () => import('~/components/cragRoutes/CragRouteDrawer.vue')
export default {
name: 'CurrentUserSendListView',
components: {
+ AscentFiltersToggleBtn,
ClimbingTypeLegend,
CragRouteDrawer,
LogBookList,
@@ -86,6 +89,7 @@ export default {
data () {
return {
loadTheRest: false,
+ outdoorAnalytikFilters: [],
loadingFigures: true,
figures: {},
@@ -115,6 +119,12 @@ export default {
}
},
+ watch: {
+ outdoorAnalytikFilters () {
+ this.getFigures()
+ }
+ },
+
mounted () {
this.getFigures()
},
@@ -123,7 +133,7 @@ export default {
getFigures () {
this.loadingFigures = true
new LogBookOutdoorApi(this.$axios, this.$auth)
- .figures()
+ .figures(this.outdoorAnalytikFilters)
.then((resp) => {
this.figures = resp.data
if (this.figures.ascents > 0) {
@@ -144,7 +154,7 @@ export default {
getClimbingTypeChart () {
this.loadingClimbingTypeChart = true
new LogBookOutdoorApi(this.$axios, this.$auth)
- .climbingTypeChart()
+ .climbingTypeChart(this.outdoorAnalytikFilters)
.then((resp) => {
this.climbingTypeData = resp.data
})
@@ -156,7 +166,7 @@ export default {
getGradeChart () {
this.loadingGradeChart = true
new LogBookOutdoorApi(this.$axios, this.$auth)
- .gradeChart()
+ .gradeChart(this.outdoorAnalytikFilters)
.then((resp) => {
this.gradeData = resp.data
})
diff --git a/services/oblyk-api/LogBookOutdoorApi.js b/services/oblyk-api/LogBookOutdoorApi.js
index a271c6d9..36b4291e 100644
--- a/services/oblyk-api/LogBookOutdoorApi.js
+++ b/services/oblyk-api/LogBookOutdoorApi.js
@@ -1,73 +1,92 @@
import BaseApi from '~/services/oblyk-api/BaseApi'
class LogBookOutdoorApi extends BaseApi {
- figures () {
+ // Method to dynamically generate the filters object
+ generateFiltersHash (filters = [], climbingType = 'all') {
+ if (!filters) { return {} }
+ return {
+ filters: {
+ only_lead_climbs: filters.includes('only_lead_climbs'),
+ only_on_sight: filters.includes('only_on_sight'),
+ no_double: filters.includes('no_double'),
+ climbing_type_filter: climbingType
+ }
+ }
+ }
+
+ figures (filters = []) {
return this.axios.request({
method: 'GET',
url: `${this.baseUrl}/current_users/log_books/outdoors/figures.json`,
headers: {
Authorization: this.authToken(),
HttpApiAccessToken: this.apiAccessToken
- }
+ },
+ params: this.generateFiltersHash(filters)
})
}
- climbingTypeChart () {
+ climbingTypeChart (filters = []) {
return this.axios.request({
method: 'GET',
url: `${this.baseUrl}/current_users/log_books/outdoors/climb_types_chart.json`,
headers: {
Authorization: this.authToken(),
HttpApiAccessToken: this.apiAccessToken
- }
+ },
+ params: this.generateFiltersHash(filters)
})
}
- gradeChart () {
+ gradeChart (filters = []) {
return this.axios.request({
method: 'GET',
url: `${this.baseUrl}/current_users/log_books/outdoors/grades_chart.json`,
headers: {
Authorization: this.authToken(),
HttpApiAccessToken: this.apiAccessToken
- }
+ },
+ params: this.generateFiltersHash(filters)
})
}
- yearChart () {
+ yearChart (filters = []) {
return this.axios.request({
method: 'GET',
url: `${this.baseUrl}/current_users/log_books/outdoors/years_chart.json`,
headers: {
Authorization: this.authToken(),
HttpApiAccessToken: this.apiAccessToken
- }
+ },
+ params: this.generateFiltersHash(filters)
})
}
- monthChart () {
+ monthChart (filters = []) {
return this.axios.request({
method: 'GET',
url: `${this.baseUrl}/current_users/log_books/outdoors/months_chart.json`,
headers: {
Authorization: this.authToken(),
HttpApiAccessToken: this.apiAccessToken
- }
+ },
+ params: this.generateFiltersHash(filters)
})
}
- evolutionChart () {
+ evolutionChart (filters = []) {
return this.axios.request({
method: 'GET',
url: `${this.baseUrl}/current_users/log_books/outdoors/evolutions_chart.json`,
headers: {
Authorization: this.authToken(),
HttpApiAccessToken: this.apiAccessToken
- }
+ },
+ params: this.generateFiltersHash(filters)
})
}
- ascendedCragRoutes (order = 'difficulty', climbingType = 'all', page = 1) {
+ ascendedCragRoutes (order = 'difficulty', climbingType = 'all', page = 1, filters = []) {
return this.axios.request({
method: 'GET',
url: `${this.baseUrl}/current_users/ascended_crag_routes.json`,
@@ -76,7 +95,7 @@ class LogBookOutdoorApi extends BaseApi {
HttpApiAccessToken: this.apiAccessToken
},
params: {
- climbing_type: climbingType,
+ ...this.generateFiltersHash(filters, climbingType),
order,
page
}
diff --git a/services/oblyk-api/UserApi.js b/services/oblyk-api/UserApi.js
index f51e10af..b234bbb8 100644
--- a/services/oblyk-api/UserApi.js
+++ b/services/oblyk-api/UserApi.js
@@ -137,7 +137,7 @@ class UserApi extends BaseApi {
},
params: {
order,
- climbing_type: climbingType,
+ filters: { climbing_type_filter: climbingType },
page
}
})