Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: misunderstand the number of items perpage #14

Merged
merged 1 commit into from
Jun 21, 2018

Conversation

zhuangqh
Copy link
Member

@zhuangqh zhuangqh commented May 28, 2018

Signed-off-by: jerryzhuang zhuangqhc@gmail.com

Ⅰ. Describe what this PR did
The number of merged PR report by pouchrobot is different from expectations. This PR correct how to compute total number of merged PR.

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how you did it

Ⅳ. Describe how to verify it

run this test code and compare it with the result from website toolbar manually.

package main

import (
	"fmt"
	"github.com/pouchcontainer/pouchrobot/server/gh"
)

var (
	repo = "pouch"
	owner = "alibaba"
)

func main() {
	ghClient := gh.NewClient(owner, repo, "")

	checkMergedPRFromDate(ghClient, "2018-05-14")
	checkMergedPRFromDate(ghClient, "2018-05-21")
}

func checkMergedPRFromDate(client *gh.Client, date string) {
	query := fmt.Sprintf("is:merged type:pr repo:%s/%s merged:>=%s", owner, repo, date)
	issueSearchResult, err := client.SearchIssues(query, nil, true)
	if err != nil {
		fmt.Println("fail to do request")
		return
	}

	fmt.Printf("%v merged pr since %s, actually get %v items\n",
		issueSearchResult.GetTotal(), date, len(issueSearchResult.Issues))
}

Ⅴ. Special notes for reviews

@zhuangqh zhuangqh changed the title bugfix: misunderstand as the number of items perpage bugfix: misunderstand the number of items perpage May 29, 2018
@allencloud
Copy link
Member

LGTM

@allencloud allencloud merged commit adac9b9 into pouchcontainer:master Jun 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants