Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
k1nho committed Sep 3, 2023
1 parent 3b5a92e commit 5357875
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions cmd/show/contributors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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()
Expand Down
24 changes: 12 additions & 12 deletions cmd/show/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -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
}
Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5357875

Please sign in to comment.