Skip to content

Commit 2535883

Browse files
authored
Merge pull request #108 from jordanopensource/feature/show-all-contributions-statistics
Feature/show all contributions statistics
2 parents c68796e + 1a2c0db commit 2535883

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

components/Stats.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
<div class="cards-container">
99
<Card
10-
:count="commitsLastMonth"
11-
description="Commits from users in Jordan in the last 30 days"
10+
:count="contributionsLastMonth"
11+
description="Contributions from users in Jordan in the last 30 days"
1212
color="blue"
1313
image="icon-commits.svg"
1414
img-size="w-10"
@@ -49,15 +49,15 @@ export default {
4949
this.$store.commit('setUsersCount', response.data.totalUsers)
5050
response = await this.$axios.get('/v1/contributions')
5151
this.$store.commit(
52-
'setCommitsLastMonth',
53-
response.data.commits_last_30_days
52+
'setContributionsLastMonth',
53+
response.data.contributions_last_30_days,
5454
)
5555
},
5656
computed: {
5757
...mapState({
5858
orgsCount: 'orgsCount',
5959
usersCount: 'usersCount',
60-
commitsLastMonth: 'commitsLastMonth',
60+
contributionsLastMonth: 'contributionsLastMonth',
6161
}),
6262
},
6363
}

pages/contributors/index.vue

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ export default {
5858
async mounted() {
5959
const lastYear = new Date().getFullYear() - 1
6060
let response = await this.$axios.get(
61-
`/v1/contributors/stats?period=${lastYear}-01-01_${lastYear}-12-31&type=users&aggregation=month`
61+
`/v1/contributors/stats?period=${lastYear}-01-01_${lastYear}-12-31&type=users&aggregation=month`,
6262
)
6363
const areaChartStats = response.data.usersStats[lastYear]
6464
6565
response = await this.$axios.get(
66-
`/v1/contributors/stats?period=${lastYear}-01-01_${lastYear}-12-31&type=commits&aggregation=month`
66+
`/v1/contributors/stats?period=${lastYear}-01-01_${lastYear}-12-31&type=contributions&aggregation=month`,
6767
)
6868
const barChartStats = response.data.commitsStats[lastYear]
6969
@@ -88,7 +88,7 @@ export default {
8888
const months = [...Array(12).keys()].map((key) =>
8989
new Date(0, key).toLocaleString('default', {
9090
month: 'short',
91-
})
91+
}),
9292
)
9393
const lastYear = new Date().getFullYear() - 1
9494
@@ -402,7 +402,7 @@ export default {
402402
const thisYear = new Date().getFullYear()
403403
404404
let response = await this.$axios.get(
405-
`/v1/contributors/stats?period=${thisYear}-01-01_${thisYear}-12-31&type=users&aggregation=month`
405+
`/v1/contributors/stats?period=${thisYear}-01-01_${thisYear}-12-31&type=users&aggregation=month`,
406406
)
407407
408408
let areaChartStats = response.data.usersStats[thisYear]
@@ -416,7 +416,7 @@ export default {
416416
} else {
417417
const lastYear = thisYear - 1
418418
response = await this.$axios.get(
419-
`/v1/contributors/stats?period=${lastYear}-01-01_${thisYear}-12-31&type=users&aggregation=month`
419+
`/v1/contributors/stats?period=${lastYear}-01-01_${thisYear}-12-31&type=users&aggregation=month`,
420420
)
421421
areaChartStats = response.data.usersStats[lastYear]
422422
areaChartStats = [areaChartStats[areaChartStats?.length - 1]]
@@ -430,7 +430,7 @@ export default {
430430
}
431431
432432
response = await this.$axios.get(
433-
`/v1/contributors/stats?period=${thisYear}-01-01_${thisYear}-12-31&type=commits&aggregation=month`
433+
`/v1/contributors/stats?period=${thisYear}-01-01_${thisYear}-12-31&type=contributions&aggregation=month`,
434434
)
435435
const barChartStats = response.data.commitsStats[thisYear]
436436
if (barChartStats?.length) {
@@ -446,7 +446,7 @@ export default {
446446
const lastYear = new Date().getFullYear() - 1
447447
448448
let response = await this.$axios.get(
449-
`/v1/contributors/stats?period=${lastYear}-01-01_${lastYear}-12-31&type=users&aggregation=month`
449+
`/v1/contributors/stats?period=${lastYear}-01-01_${lastYear}-12-31&type=users&aggregation=month`,
450450
)
451451
const areaChartStats = response.data.usersStats[lastYear]
452452
let months = [...Array(areaChartStats.length).keys()].map((key) => {
@@ -457,7 +457,7 @@ export default {
457457
this.changeAreaChartOptions(areaChartStats, months, lastYear)
458458
459459
response = await this.$axios.get(
460-
`/v1/contributors/stats?period=${lastYear}-01-01_${lastYear}-12-31&type=commits&aggregation=month`
460+
`/v1/contributors/stats?period=${lastYear}-01-01_${lastYear}-12-31&type=contributions&aggregation=month`,
461461
)
462462
const barChartStats = response.data.commitsStats[lastYear]
463463
months = [...Array(barChartStats.length).keys()].map((key) => {
@@ -473,7 +473,7 @@ export default {
473473
const year = lastMonthDate.getFullYear()
474474
475475
let response = await this.$axios.get(
476-
`/v1/contributors/stats?period=${year}-01-01_${year}-12-31&type=users&aggregation=day`
476+
`/v1/contributors/stats?period=${year}-01-01_${year}-12-31&type=users&aggregation=day`,
477477
)
478478
479479
const areaChartStats =
@@ -485,14 +485,14 @@ export default {
485485
{
486486
day: 'numeric',
487487
month: 'numeric',
488-
}
488+
},
489489
)
490490
})
491491
const tickAmount = 5
492492
this.changeAreaChartOptions(areaChartStats, days, year, tickAmount)
493493
494494
response = await this.$axios.get(
495-
`/v1/contributors/stats?period=${year}-01-01_${year}-12-31&type=commits&aggregation=day`
495+
`/v1/contributors/stats?period=${year}-01-01_${year}-12-31&type=contributions&aggregation=day`,
496496
)
497497
const barChartStats =
498498
response.data.commitsStats[year][lastMonthDate.getMonth()]
@@ -502,7 +502,7 @@ export default {
502502
{
503503
day: 'numeric',
504504
month: 'numeric',
505-
}
505+
},
506506
)
507507
})
508508
this.changeBarChartOptions(barChartStats, days, year, tickAmount)

store/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const state = () => ({
22
orgsCount: 0,
33
usersCount: 0,
4-
commitsLastMonth: 0,
4+
contributionsLastMonth: 0,
55
users: [],
66
orgs: [],
77
pageCount: 0,
@@ -42,8 +42,8 @@ export const mutations = {
4242
setUsersCount(state, usersCount) {
4343
state.usersCount = usersCount
4444
},
45-
setCommitsLastMonth(state, commitsLastMonth) {
46-
state.commitsLastMonth = commitsLastMonth
45+
setContributionsLastMonth(state, contributionsLastMonth) {
46+
state.contributionsLastMonth = contributionsLastMonth
4747
},
4848
setPageCount(state, pageCount) {
4949
state.pageCount = pageCount

0 commit comments

Comments
 (0)