Skip to content

Commit

Permalink
[#2054] Fix zoom view bug (#2055)
Browse files Browse the repository at this point in the history
Currently, when granularity is set to day or week, clicking on a ramp
will open up a zoom view where commit messages are not being displayed
and sorting by insertions does not result in any sorting. 

Let's fix the unintended behaviour of the zoom view.
  • Loading branch information
jq1836 committed Oct 28, 2023
1 parent 0c4045d commit 00cf40d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions frontend/src/components/c-ramp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,15 @@ export default defineComponent({
}
const zoomUser = { ...user };
// Type cast here is unsafe
zoomUser.commits = user.dailyCommits as Commit[];
// Calculate total commit result insertion and deletion for the daily/weekly commit selected
zoomUser.commits = user.dailyCommits.map(
(dailyCommit) => ({
insertions: dailyCommit.commitResults.reduce((acc, currCommitResult) => acc + currCommitResult.insertions, 0),
deletions: dailyCommit.commitResults.reduce((acc, currCommitResult) => acc + currCommitResult.deletions, 0),
...dailyCommit,
commitResults: dailyCommit.commitResults.map((commitResult) => ({ ...commitResult, isOpen: true })),
}),
) as Commit[];
const info = {
zRepo: user.repoName,
Expand Down

0 comments on commit 00cf40d

Please sign in to comment.