add red square for failure to commit today

This commit is contained in:
2023-02-02 22:00:24 -08:00
parent dc1d43e69e
commit ada61387f2
2 changed files with 28 additions and 8 deletions

View File

@@ -18,6 +18,9 @@ func main() {
r := mux.NewRouter()
r.HandleFunc("/weekly.svg", func(w http.ResponseWriter, r *http.Request) {
author := r.URL.Query().Get("author")
highlight := r.URL.Query().Get("highlight")
shouldHighlight := highlight != ""
w.Header().Add("Content-Type", "text/html")
repoPaths, err := commits.GetMRRepos()
if err != nil {
@@ -27,7 +30,7 @@ func main() {
if err != nil {
panic(err)
}
svg := svg.GetWeekSVG(week)
svg := svg.GetWeekSVG(week, shouldHighlight)
svg.WriteTo(w)
})
r.HandleFunc("/stats.json", func(w http.ResponseWriter, r *http.Request) {
@@ -54,8 +57,13 @@ func main() {
year := time.Now().Year()
yst := r.URL.Query().Get("year")
author := r.URL.Query().Get("author")
highlight := r.URL.Query().Get("highlight")
shouldHighlight := highlight != ""
y, err := strconv.Atoi(yst)
if err == nil {
if year != y {
shouldHighlight = false
}
year = y
}
repoPaths, err := commits.GetMRRepos()
@@ -66,7 +74,7 @@ func main() {
if err != nil {
panic(err)
}
svg := svg.GetYearSVG(freq)
svg := svg.GetYearSVG(freq, shouldHighlight)
w.Header().Add("Content-Type", "text/html")
svg.WriteTo(w)
})