diff --git a/cmd/show/contributors.go b/cmd/show/contributors.go index 7ce97bf..3e04ce2 100644 --- a/cmd/show/contributors.go +++ b/cmd/show/contributors.go @@ -22,7 +22,7 @@ type ( // BackMsg: message to signal main model that we are back to dashboard when backspace is pressed BackMsg struct{} - // ContributorErrMsg: message to signal that an error ocurred when fetching contributor information + // ContributorErrMsg: message to signal that an error occurred when fetching contributor information ContributorErrMsg struct { name string err error @@ -63,7 +63,7 @@ func (m ContributorModel) View() string { } // fetchUser: fetches all the user information (general info, and pull requests) -func (model *ContributorModel) fetchUser() error { +func (m *ContributorModel) fetchUser() error { var ( wg sync.WaitGroup errChan = make(chan error, 2) @@ -72,23 +72,23 @@ func (model *ContributorModel) fetchUser() error { wg.Add(2) go func() { defer wg.Done() - userInfo, err := fetchContributorInfo(model.username) + userInfo, err := fetchContributorInfo(m.username) if err != nil { errChan <- err return } - model.userInfo = userInfo + m.userInfo = userInfo }() go func() { defer wg.Done() - userPRs, err := fetchContributorPRs(model.username) + userPRs, err := fetchContributorPRs(m.username) if err != nil { errChan <- err return } - model.userPrs = userPRs + m.userPrs = userPRs }() wg.Wait() diff --git a/cmd/show/dashboard.go b/cmd/show/dashboard.go index 6924cd1..e6a056f 100644 --- a/cmd/show/dashboard.go +++ b/cmd/show/dashboard.go @@ -246,7 +246,7 @@ func validateShowQuery(opts *Options) error { } // FetchAllContributors: fetchs and sets all the contributors (new, alumni) -func (model *DashboardModel) FetchAllContributors() error { +func (m *DashboardModel) FetchAllContributors() error { var ( errorChan = make(chan error, 2) wg sync.WaitGroup @@ -255,22 +255,22 @@ func (model *DashboardModel) FetchAllContributors() error { wg.Add(2) go func() { defer wg.Done() - newContributors, err := model.FetchNewContributors() + newContributors, err := m.FetchNewContributors() if err != nil { errorChan <- err return } - model.newContributorsTable = setupContributorsTable(newContributors) + m.newContributorsTable = setupContributorsTable(newContributors) }() go func() { defer wg.Done() - alumniContributors, err := model.FetchAlumniContributors() + alumniContributors, err := m.FetchAlumniContributors() if err != nil { errorChan <- err return } - model.alumniContributorsTable = setupContributorsTable(alumniContributors) + m.alumniContributorsTable = setupContributorsTable(alumniContributors) }() wg.Wait() @@ -287,9 +287,9 @@ func (model *DashboardModel) FetchAllContributors() error { } // FetchNewContributors: Returns all the new contributors -func (model *DashboardModel) FetchNewContributors() ([]client.DbPullRequestContributor, error) { - resp, r, err := model.APIClient.ContributorsServiceAPI.NewPullRequestContributors(model.serverContext).Page(int32(model.queryOptions[0])). - Limit(int32(model.queryOptions[1])).RepoIds(strconv.Itoa(int(model.RepositoryInfo.Id))).Execute() +func (m *DashboardModel) FetchNewContributors() ([]client.DbPullRequestContributor, error) { + resp, r, err := m.APIClient.ContributorsServiceAPI.NewPullRequestContributors(m.serverContext).Page(int32(m.queryOptions[0])). + Limit(int32(m.queryOptions[1])).RepoIds(strconv.Itoa(int(m.RepositoryInfo.Id))).Execute() if err != nil { return nil, err } @@ -303,10 +303,10 @@ func (model *DashboardModel) FetchNewContributors() ([]client.DbPullRequestContr } // FetchAlumniContributors: Returns all alumni contributors -func (model *DashboardModel) FetchAlumniContributors() ([]client.DbPullRequestContributor, error) { - resp, r, err := model.APIClient.ContributorsServiceAPI.FindAllChurnPullRequestContributors(model.serverContext). - Page(int32(model.queryOptions[0])).Limit(int32(model.queryOptions[1])). - Range_(int32(model.queryOptions[2])).RepoIds(strconv.Itoa(int(model.RepositoryInfo.Id))).Execute() +func (m *DashboardModel) FetchAlumniContributors() ([]client.DbPullRequestContributor, error) { + resp, r, err := m.APIClient.ContributorsServiceAPI.FindAllChurnPullRequestContributors(m.serverContext). + Page(int32(m.queryOptions[0])).Limit(int32(m.queryOptions[1])). + Range_(int32(m.queryOptions[2])).RepoIds(strconv.Itoa(int(m.RepositoryInfo.Id))).Execute() if err != nil { return nil, err } diff --git a/go.mod b/go.mod index a7b5500..f1cf158 100644 --- a/go.mod +++ b/go.mod @@ -15,9 +15,9 @@ require ( ) require ( - github.com/google/uuid v1.3.0 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect + github.com/google/uuid v1.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/mattn/go-isatty v0.0.18 // indirect