finish merging

This commit is contained in:
2023-01-30 23:03:08 -08:00
parent 38bc9bcf94
commit aa28e5b264
10 changed files with 49 additions and 197 deletions

View File

@@ -9,13 +9,16 @@ import (
)
func main() {
wfreq := []int{}
yd := time.Now().YearDay()
n := time.Now()
repoPaths, err := commits.GetMRRepos()
if err != nil {
panic(err)
}
freq, err := repoPaths.GlobalFrequency(time.Now().Year(), []string{""})
freq, err := repoPaths.Frequency(n.Year(), []string{""})
if err != nil {
panic(err)
}
wfreq, err := repoPaths.GetWeekFreq([]string{""})
if err != nil {
panic(err)
}

View File

@@ -14,7 +14,7 @@ type Repo git.Repository
func main() {
year := time.Now().Year() - 1
authors := []string{"Groot"}
gfreq, err := commits.GlobalFrequencyChan(year, authors)
gfreq, err := commits.FrequencyChan(year, authors)
if err != nil {
panic(err)
}

View File

@@ -1,7 +1,6 @@
package main
import (
"fmt"
"net/http"
"strconv"
"time"
@@ -19,33 +18,14 @@ func main() {
r.HandleFunc("/weekly.svg", func(w http.ResponseWriter, r *http.Request) {
author := r.URL.Query().Get("author")
w.Header().Add("Content-Type", "text/html")
now := time.Now()
year := now.Year()
repoPaths, err := commits.GetMRRepos()
if err != nil {
panic(err)
}
freq, err := repoPaths.FrequencyChan(year, []string{author})
week, err := repoPaths.GetWeekFreq([]string{author})
if err != nil {
panic(err)
}
today := now.YearDay() - 1
fmt.Println(today)
if today < 6 {
curYear := year - 1
curFreq, err := repoPaths.FrequencyChan(curYear, []string{author})
if err != nil {
panic(err)
}
freq = append(curFreq, freq...)
today += 365
if curYear%4 == 0 {
today++
}
}
fmt.Println(freq)
week := freq[today-6 : today+1]
svg := svg.GetWeekSVG(week)
svg.WriteTo(w)
})