Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge development into main #109

Merged
merged 4 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions components/Stats.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

<div class="cards-container">
<Card
:count="commitsLastMonth"
description="Commits from users in Jordan in the last 30 days"
:count="contributionsLastMonth"
description="Contributions from users in Jordan in the last 30 days"
color="blue"
image="icon-commits.svg"
img-size="w-10"
Expand Down Expand Up @@ -49,15 +49,15 @@ export default {
this.$store.commit('setUsersCount', response.data.totalUsers)
response = await this.$axios.get('/v1/contributions')
this.$store.commit(
'setCommitsLastMonth',
response.data.commits_last_30_days
'setContributionsLastMonth',
response.data.contributions_last_30_days,
)
},
computed: {
...mapState({
orgsCount: 'orgsCount',
usersCount: 'usersCount',
commitsLastMonth: 'commitsLastMonth',
contributionsLastMonth: 'contributionsLastMonth',
}),
},
}
Expand Down
24 changes: 12 additions & 12 deletions pages/contributors/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ export default {
async mounted() {
const lastYear = new Date().getFullYear() - 1
let response = await this.$axios.get(
`/v1/contributors/stats?period=${lastYear}-01-01_${lastYear}-12-31&type=users&aggregation=month`
`/v1/contributors/stats?period=${lastYear}-01-01_${lastYear}-12-31&type=users&aggregation=month`,
)
const areaChartStats = response.data.usersStats[lastYear]

response = await this.$axios.get(
`/v1/contributors/stats?period=${lastYear}-01-01_${lastYear}-12-31&type=commits&aggregation=month`
`/v1/contributors/stats?period=${lastYear}-01-01_${lastYear}-12-31&type=contributions&aggregation=month`,
)
const barChartStats = response.data.commitsStats[lastYear]

Expand All @@ -88,7 +88,7 @@ export default {
const months = [...Array(12).keys()].map((key) =>
new Date(0, key).toLocaleString('default', {
month: 'short',
})
}),
)
const lastYear = new Date().getFullYear() - 1

Expand Down Expand Up @@ -402,7 +402,7 @@ export default {
const thisYear = new Date().getFullYear()

let response = await this.$axios.get(
`/v1/contributors/stats?period=${thisYear}-01-01_${thisYear}-12-31&type=users&aggregation=month`
`/v1/contributors/stats?period=${thisYear}-01-01_${thisYear}-12-31&type=users&aggregation=month`,
)

let areaChartStats = response.data.usersStats[thisYear]
Expand All @@ -416,7 +416,7 @@ export default {
} else {
const lastYear = thisYear - 1
response = await this.$axios.get(
`/v1/contributors/stats?period=${lastYear}-01-01_${thisYear}-12-31&type=users&aggregation=month`
`/v1/contributors/stats?period=${lastYear}-01-01_${thisYear}-12-31&type=users&aggregation=month`,
)
areaChartStats = response.data.usersStats[lastYear]
areaChartStats = [areaChartStats[areaChartStats?.length - 1]]
Expand All @@ -430,7 +430,7 @@ export default {
}

response = await this.$axios.get(
`/v1/contributors/stats?period=${thisYear}-01-01_${thisYear}-12-31&type=commits&aggregation=month`
`/v1/contributors/stats?period=${thisYear}-01-01_${thisYear}-12-31&type=contributions&aggregation=month`,
)
const barChartStats = response.data.commitsStats[thisYear]
if (barChartStats?.length) {
Expand All @@ -446,7 +446,7 @@ export default {
const lastYear = new Date().getFullYear() - 1

let response = await this.$axios.get(
`/v1/contributors/stats?period=${lastYear}-01-01_${lastYear}-12-31&type=users&aggregation=month`
`/v1/contributors/stats?period=${lastYear}-01-01_${lastYear}-12-31&type=users&aggregation=month`,
)
const areaChartStats = response.data.usersStats[lastYear]
let months = [...Array(areaChartStats.length).keys()].map((key) => {
Expand All @@ -457,7 +457,7 @@ export default {
this.changeAreaChartOptions(areaChartStats, months, lastYear)

response = await this.$axios.get(
`/v1/contributors/stats?period=${lastYear}-01-01_${lastYear}-12-31&type=commits&aggregation=month`
`/v1/contributors/stats?period=${lastYear}-01-01_${lastYear}-12-31&type=contributions&aggregation=month`,
)
const barChartStats = response.data.commitsStats[lastYear]
months = [...Array(barChartStats.length).keys()].map((key) => {
Expand All @@ -473,7 +473,7 @@ export default {
const year = lastMonthDate.getFullYear()

let response = await this.$axios.get(
`/v1/contributors/stats?period=${year}-01-01_${year}-12-31&type=users&aggregation=day`
`/v1/contributors/stats?period=${year}-01-01_${year}-12-31&type=users&aggregation=day`,
)

const areaChartStats =
Expand All @@ -485,14 +485,14 @@ export default {
{
day: 'numeric',
month: 'numeric',
}
},
)
})
const tickAmount = 5
this.changeAreaChartOptions(areaChartStats, days, year, tickAmount)

response = await this.$axios.get(
`/v1/contributors/stats?period=${year}-01-01_${year}-12-31&type=commits&aggregation=day`
`/v1/contributors/stats?period=${year}-01-01_${year}-12-31&type=contributions&aggregation=day`,
)
const barChartStats =
response.data.commitsStats[year][lastMonthDate.getMonth()]
Expand All @@ -502,7 +502,7 @@ export default {
{
day: 'numeric',
month: 'numeric',
}
},
)
})
this.changeBarChartOptions(barChartStats, days, year, tickAmount)
Expand Down
6 changes: 3 additions & 3 deletions store/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const state = () => ({
orgsCount: 0,
usersCount: 0,
commitsLastMonth: 0,
contributionsLastMonth: 0,
users: [],
orgs: [],
pageCount: 0,
Expand Down Expand Up @@ -42,8 +42,8 @@ export const mutations = {
setUsersCount(state, usersCount) {
state.usersCount = usersCount
},
setCommitsLastMonth(state, commitsLastMonth) {
state.commitsLastMonth = commitsLastMonth
setContributionsLastMonth(state, contributionsLastMonth) {
state.contributionsLastMonth = contributionsLastMonth
},
setPageCount(state, pageCount) {
state.pageCount = pageCount
Expand Down