-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Implement contributors graph #27882
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
Merged
Merged
Implement contributors graph #27882
Changes from 151 commits
Commits
Show all changes
190 commits
Select commit
Hold shift + click to select a range
9fd24bc
Create new page
sahinakkaya 3975abd
Implement simple api
sahinakkaya 19deef6
Implement basic graph render
sahinakkaya 715fc15
Handle dates by grouping them into weeks
sahinakkaya 136d8be
Split vue file into meaningful pieces
sahinakkaya be50ead
Remove non-needed code
sahinakkaya 3211417
Implement contributors graph
sahinakkaya 88247fd
Switch to unix timestamp
sahinakkaya a393093
Show contributor rank
sahinakkaya e8e0e34
Multiply x with 1000 to make it milliseconds
sahinakkaya ff17e01
Remove legend, format numbers
sahinakkaya 664747a
Implement contribution type selection
sahinakkaya 2c567ea
Draw charts basaed on selected contribution type
sahinakkaya 8ef0c35
Show all sundays until today instead of latest commit
sahinakkaya bc396c0
Show date range in title
sahinakkaya 630c2dd
Add zoom/pan support to charts
sahinakkaya d293f24
Sync charts on zoom/pan events
sahinakkaya 2304a5d
Format everything with gofmt
sahinakkaya a047e07
Disable animations for performance
sahinakkaya 34f9d92
Reset zoom when clicking on chart
sahinakkaya f210a51
Disable grid for x axis
sahinakkaya 9af88ec
Refactor
sahinakkaya 4399890
Remove unused api endpoint
sahinakkaya e94b9c7
Merge branch 'main' into main
sahinakkaya a4b6666
Use a better name for variable
sahinakkaya c75b7a5
Implement new endpoint for fetching contributors data
sahinakkaya e29efb2
Use new endpoint for fetching contributors data
sahinakkaya b516a67
Introduce a new endpoint for fetching data in frontend
sahinakkaya 4ee972c
Apply suggestions from code review
sahinakkaya 90e3d50
Do not use hard-coded colors
sahinakkaya 0dfd908
Make object key snake_case
sahinakkaya 2c174d6
Add copyright header
sahinakkaya 730368e
Fix linting errors
sahinakkaya 32fe51e
Use actual commit ID instead of empty string
sahinakkaya 5e16adf
Merge branch 'main' into main
6543 0dd9095
Generate swagger
sahinakkaya ffab20b
Merge branch 'main' into main
sahinakkaya 3196641
Lower height of graph
sahinakkaya 5e66e27
Merge branch 'main' into main
sahinakkaya a886f57
Remove translation to other languages
sahinakkaya f278598
Add newline at end of swagger file
sahinakkaya beb7382
Move header from Go template to Vue
sahinakkaya e169731
Merge branch 'main' into main
sahinakkaya 4c5170b
Merge branch 'main' into main
sahinakkaya 8dce947
Fix package-lock.json
sahinakkaya 4f74932
Adjust the location of the contributors page
hiifong 677ac20
Merge branch 'go-gitea:main' into contributors
hiifong 1cbeabf
fix lint
hiifong e047458
make generate-swagger
hiifong 49eaf6d
fix typo
hiifong 3dcbba3
Merge pull request #1 from hiifong/contributors
sahinakkaya a8d2a9c
Merge branch 'main' into main
sahinakkaya 3e156ab
Cherry-pick 64f2d7026 and resolve conflicts
silverwind 7947bf9
Try updating date range when zoom or pan occurs
sahinakkaya 3d62edc
Use v-memo to avoid unnecessary re-render
sahinakkaya e27ea6c
Merge branch 'update-date'
sahinakkaya e5537cc
Preparation step for sorting contributor graphs
sahinakkaya 7a69f2e
Update contributor graphs based on selected date range
sahinakkaya 5d2b764
Calculate total stats while looping to avoid unnecessary computation …
sahinakkaya d0714e7
Sort contributors based on selected contribution type
sahinakkaya b273ba7
Do not show contributor graph if total contribution is 0 on selected …
sahinakkaya 1e163bb
Set highest value for contributor graphs dynamically
sahinakkaya e4ccffd
Fix a bug while parsing the commits
sahinakkaya 1ba2157
Merge branch 'main' into main
sahinakkaya 6ffe1f1
Fix linting errors
sahinakkaya 43bf7ec
Merge branch 'main' into main
sahinakkaya 497ce76
Fix linting errors
sahinakkaya 145d3ca
Fix linting errors
sahinakkaya d550ba7
Merge branch 'main' into main
sahinakkaya 991e3c0
Show loading animation while fetching data
sahinakkaya 8ba3674
Eliminate unnecessary fetch when contribution type changes
sahinakkaya b148d1a
Reset all charts when main chart is clicked
sahinakkaya 5de9fbf
Handle errors which can occure while fetching data
sahinakkaya 79dfb84
Apply suggestions from code review
sahinakkaya ec30e3b
Apply suggestions from code review
sahinakkaya 51f8118
Use translated strings
sahinakkaya 7e68c7c
Do code splitting on contributors page
sahinakkaya 056745b
Use author information instead of committer
sahinakkaya d6887e4
Move contributor related code under service
sahinakkaya 8ed40fe
Apply suggestions from code review
sahinakkaya 3fc79af
Apply suggestions from code review
sahinakkaya d51417d
Merge branch 'main' into main
6543 75b92e3
Merge remote-tracking branch 'upstream/main' into main
sahinakkaya 09d249d
Apply suggestions from code review
sahinakkaya 023bbbb
Use GET instead of fetch
sahinakkaya e83b562
Re-order tags to script - template - style in vue file
sahinakkaya f2d3394
Remove useless error checking
sahinakkaya ca59188
Merge branch 'main' into main
6543 7f1f49f
Merge remote-tracking branch 'upstream/main'
sahinakkaya e953057
Merge remote-tracking branch 'upstream/main'
sahinakkaya 88ffba5
Apply suggestions from code review
sahinakkaya 12cc6d6
Merge remote-tracking branch 'upstream/main'
sahinakkaya ce1306b
Merge branch 'main' into main
6543 80e6614
Fix linting errors
sahinakkaya 8d07fdd
Merge branch 'main' into main
6543 248065f
dayjs
6543 ba4e738
generate
6543 b6b4881
fmt
6543 9e50232
Merge branch 'main' into sahinakkaya/main
6543 2bf4ce0
Fix locale usage
sahinakkaya 0d08f06
layout fixes
silverwind f47560c
Merge branch 'main' into contributors-graph
silverwind 325fc9b
Combine email addresses linked to same gitea user together
sahinakkaya 4135808
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya 2b2d0ef
reduce main graph to 280px height
silverwind 36d8e81
color and chart rendering enhancements
silverwind 4d2905b
make fmt
silverwind a151d51
js formatting
silverwind 6ebc6ce
Use constant from time package instead of manually defining it
sahinakkaya 86e0204
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya b50929b
Remove useless data from page context
sahinakkaya 043f2a2
Update templates/repo/navbar.tmpl
silverwind dd2664d
Update templates/repo/navbar.tmpl
silverwind 1c9b0f5
Apply suggestions from code review
sahinakkaya efd6ace
Merge branch 'main' into contributors-graph
6543 ebf5af2
Backend Asnyc
6543 6dc6438
Merge branch 'main' into contributors-graph
6543 8c35b11
use status 216
6543 de1b537
Handle http 216 on client side
sahinakkaya bf35e58
Merge branch 'main' into contributors-graph
6543 cc4f996
body
6543 1660802
fix
6543 af7463a
Merge branch 'main' into contributors-graph
6543 ed1506e
Fix frontend
sahinakkaya 6b1593f
Fix a small error
sahinakkaya f31d0a3
Fix frontend
sahinakkaya 112897d
Use status 202
sahinakkaya 130f3f4
Fix linting errors
sahinakkaya 2c2d376
sync x axis in all graph
yp05327 3777a9e
fix lint
yp05327 f3bf5a4
display the whole graph
yp05327 f0ef0f3
improve avatar
yp05327 8552c9e
convert click into double click
yp05327 1f3b9f8
Apply suggestions from code review
sahinakkaya ade291c
Merge pull request #3 from yp05327/pr27882
sahinakkaya dec493b
Fix max chart value
sahinakkaya 34be281
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya 2665147
Use drag to zoom
sahinakkaya bc04a82
Add instructions on how to zoom pan etc.
sahinakkaya 8de2f7d
Fix title
sahinakkaya cbd51b3
Merge branch 'main' into contributors-graph
silverwind 44311a0
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya e43e6b9
generate swagger
sahinakkaya 20b6bb7
fmt
sahinakkaya fab3f83
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya 07794ca
Merge branch 'main' into contributors-graph
6543 4834f97
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya d0bca3f
Merge branch 'main' into contributors-graph
6543 51ea778
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya 31f459e
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya c860b02
Fix linting error in swagger file
sahinakkaya e8a5c57
Target correct dropdown
sahinakkaya 51a9e8d
Move ExtendedCommitStats to service layer
sahinakkaya 7a134de
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya 3740877
Remove exposed endpoint as it is not needed by this PR
sahinakkaya ae47624
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya 0f61e59
Move types out from "modules/structs" to not pollute api
sahinakkaya 07eb1d1
Apply suggestions from code review
sahinakkaya e52db02
Do not render 'a' tag if user is not present on the server
sahinakkaya cd23a86
Fix linting error
sahinakkaya 7c91b21
Merge branch 'main' into contributors-graph
silverwind 3216a74
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya 9b337dc
Adopt changes in upstream
sahinakkaya 63cf7f2
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya 48f175c
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya ae97fbd
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya 6094559
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya 93987ca
Merge branch 'main' into contributors-graph
6543 6e87cd8
unexport internal used func
6543 09a9c62
fix nil pointer issue found by test
6543 e968a8f
unexport another internal used func
6543 93f9b2b
add test and expected outcome + add some codecoments to be solved
6543 2b06e09
expand test with total "summary user"
6543 3ba73e3
Fix linting error
sahinakkaya 1d0eca1
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya ecb412b
Fix implementation to satisfy unit test
sahinakkaya 88c57f9
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya 344ed41
Fix linting error
sahinakkaya 09d5d27
fix lint error and use dayjs to get sundays
silverwind c05d215
refactor property access, remove empty line
silverwind 1c203d1
fix eslint parser error
silverwind 9fb946b
rename 'sundays' to 'startDays' in js, add trailing commas
silverwind 5e51092
Add raw hours to generate timestamps correctly
sahinakkaya 0c53d38
Use current time as end date instead of last commit's time
sahinakkaya c3f8e93
Fix linting error
sahinakkaya 20520c9
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya ee1de50
extract time-related functions to file and add test for startDaysBetween
silverwind 3b7b636
use better end date
silverwind eb3c797
Explain issue in comment instead of writing external link
sahinakkaya 316e871
Merge branch 'main' into contributors-graph
6543 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Copyright 2023 The Gitea Authors. All rights reserved. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package util | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
const layout = time.DateOnly | ||
|
||
func ListSundaysBetween(startStr, endStr string) ([]int64, error) { | ||
startDate, err := time.Parse(layout, startStr) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
endDate, err := time.Parse(layout, endStr) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
// Ensure the start date is a Sunday | ||
for startDate.Weekday() != time.Sunday { | ||
startDate = startDate.AddDate(0, 0, 1) | ||
} | ||
|
||
var sundays []int64 | ||
|
||
// Iterate from start date to end date and find all Sundays | ||
for currentDate := startDate; currentDate.Before(endDate); currentDate = currentDate.AddDate(0, 0, 7) { | ||
sundays = append(sundays, currentDate.UnixMilli()) | ||
} | ||
|
||
return sundays, nil | ||
} | ||
|
||
func FindLastSundayBeforeDate(dateStr string) (string, error) { | ||
date, err := time.Parse(layout, dateStr) | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
weekday := date.Weekday() | ||
daysToSubtract := int(weekday) - int(time.Sunday) | ||
if daysToSubtract < 0 { | ||
daysToSubtract += 7 | ||
} | ||
|
||
lastSunday := date.AddDate(0, 0, -daysToSubtract) | ||
return lastSunday.Format(layout), nil | ||
} | ||
|
||
func FindFirstSundayAfterDate(dateStr string) (string, error) { | ||
date, err := time.Parse(layout, dateStr) | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
weekday := date.Weekday() | ||
daysToAdd := int(time.Sunday) - int(weekday) | ||
if daysToAdd <= 0 { | ||
daysToAdd += 7 | ||
} | ||
|
||
firstSunday := date.AddDate(0, 0, daysToAdd) | ||
return firstSunday.Format(layout), nil | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.