mid-merge

This commit is contained in:
2023-01-30 22:32:28 -08:00
parent 62780ba810
commit 38bc9bcf94
5 changed files with 202 additions and 31 deletions

View File

@@ -2,29 +2,22 @@ package main
import (
"fmt"
"math/rand"
"time"
"github.com/taigrr/gico/commits"
"github.com/taigrr/gico/graph/term"
)
func init() {
rand.Seed(time.Now().UnixMilli())
}
func main() {
wfreq := []int{}
yd := time.Now().YearDay()
freq, _ := commits.GlobalFrequency(time.Now().Year(), []string{""})
if yd < 7 {
// xfreq, _ := commits.GlobalFrequency(time.Now().Year()-1, []string{""})
} else {
// TODO fix bug for negative in first week of Jan
for i := 0; i < 7; i++ {
d := time.Now().YearDay() - 1 - 6 + i
wfreq = append(wfreq, freq[d])
}
repoPaths, err := commits.GetMRRepos()
if err != nil {
panic(err)
}
freq, err := repoPaths.GlobalFrequency(time.Now().Year(), []string{""})
if err != nil {
panic(err)
}
fmt.Println("week:")
fmt.Println(term.GetWeekUnicode(wfreq))

View File

@@ -21,7 +21,11 @@ func main() {
w.Header().Add("Content-Type", "text/html")
now := time.Now()
year := now.Year()
freq, err := commits.GlobalFrequencyChan(year, []string{author})
repoPaths, err := commits.GetMRRepos()
if err != nil {
panic(err)
}
freq, err := repoPaths.FrequencyChan(year, []string{author})
if err != nil {
panic(err)
}
@@ -29,7 +33,7 @@ func main() {
fmt.Println(today)
if today < 6 {
curYear := year - 1
curFreq, err := commits.GlobalFrequencyChan(curYear, []string{author})
curFreq, err := repoPaths.FrequencyChan(curYear, []string{author})
if err != nil {
panic(err)
}
@@ -53,7 +57,11 @@ func main() {
if err == nil {
year = y
}
freq, err := commits.GlobalFrequencyChan(year, []string{author})
repoPaths, err := commits.GetMRRepos()
if err != nil {
panic(err)
}
freq, err := repoPaths.FrequencyChan(year, []string{author})
if err != nil {
panic(err)
}