diff --git a/TODO b/TODO index 5bd942f..1620fef 100644 --- a/TODO +++ b/TODO @@ -1,9 +1,14 @@ -Notes: -- Option to disable HTTP request cache (or at least expire user/organization queries) -- Will need to get/store timezone of user (use https://bitbucket.org/pellepim/jstimezonedetect, use it with time.Location.LoadLocation) -- To get digests for non-user owned organizations, will need to list the organizations and their repositories +TODO - Handle pagination for repository list - Handle pagination for commit list +- Digests for activity every year going back to the oldest repository +- List all repostories that were included in the the search in a footer of the template +- Option to disable HTTP request cache (or at least expire user/organization queries) +- Weekly vs. daily option + +Notes: +- Will need to get/store timezone of user (use https://bitbucket.org/pellepim/jstimezonedetect, use it with time.Location.LoadLocation) +- To get digests for non-user owned organizations, will need to list the organizations and their repositories - To make a raw HTTP request with the github package: httpReq, _ := githubClient.NewRequest("GET", "user/teams", nil) var jsonResp interface{} diff --git a/app/githop.go b/app/githop.go index b790a54..2d8d11a 100644 --- a/app/githop.go +++ b/app/githop.go @@ -132,6 +132,24 @@ func indexHandler(w http.ResponseWriter, r *http.Request) { http.Error(w, err.Error(), http.StatusInternalServerError) return } + + orgs, _, err := githubClient.Organizations.List("", nil) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + for _, org := range orgs { + orgRepos, _, err := githubClient.Repositories.ListByOrg(*org.Login, nil) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + newRepos := make([]github.Repository, len(repos) + len(orgRepos)) + copy(newRepos, repos) + copy(newRepos[len(repos):], orgRepos) + repos = newRepos + } + now := time.Now() digestStartTime := time.Date(now.Year()-1, now.Month(), now.Day(), 0, 0, 0, 0, now.Location()) digestEndTime := digestStartTime.AddDate(0, 0, 7)