Skip to content

Commit

Permalink
minor fix for user progress bar in project stats
Browse files Browse the repository at this point in the history
  • Loading branch information
khansadaoudi committed Sep 19, 2024
1 parent 66d1eec commit a8237ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/api/backend-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ export interface statProject_t {
samplesNumber: number,
treesNumber: number,
tokensNumber: number,
sentencesNumber: number,
topUser: topUser_t,
lastRead: lastRead_t,
lastWrite: lastWrite_t,
Expand Down
5 changes: 3 additions & 2 deletions src/components/project/StatisticsProject.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ export default defineComponent({
samplesNumber: 0,
treesNumber: 0,
tokensNumber: 0,
sentencesNumber: 0,
topUser: { username: '', treesNumber: 0, userAvatar: '' },
lastRead: { lastRead: 0, lastReadUsername: '' },
lastWrite: { lastWrite: 0, lastWriteUsername: '' },
Expand Down Expand Up @@ -177,8 +178,8 @@ export default defineComponent({
.then((response) => {
this.projectStat = { ...response.data };
if (this.projectStat.topUser) {
this.topUserProgress = this.projectStat.topUser.treesNumber / this.projectStat.treesNumber;
this.topUserProgressLabel = `${(this.projectStat.topUser.treesNumber / this.projectStat.treesNumber * 100).toFixed(2)} %`;
this.topUserProgress = this.projectStat.topUser.treesNumber / this.projectStat.sentencesNumber;
this.topUserProgressLabel = `${(this.projectStat.topUser.treesNumber / this.projectStat.sentencesNumber * 100).toFixed(2)} %`;
}
})
.catch((error) => {
Expand Down

0 comments on commit a8237ab

Please sign in to comment.