Beispiel #1
0
func HandleIssues(b []byte) {
	defer PanicHandler(true)
	payload, err := UnmarshalIssues(b)
	if err != nil {
		log.Println("Error decoding Commit Comment payload:", err)
		return
	}

	gu := payload.Sender
	gr := payload.Repo
	o := payload.Organization

	p, ta, err := FindIssuesPointsAndTrophyAction(payload)
	if err != nil {
		log.Println("Issues payload error:", err)
		return
	}

	user, _ := entities.NewUserWithGithubData(gu)
	repo, _ := entities.NewRepoWithGithubData(gr)
	org, _ := entities.NewOrganizationWithGithubData(o)

	err = DistributeScores(p, user, repo, org)
	if err != nil {
		log.Println("Error distributing scores:", err)
	}
	err = RegisterAction(ta, user)
	if err != nil {
		log.Println("Error registrating action:", err)
	}
}
Beispiel #2
0
func HandleCommitComment(b []byte) {
	defer PanicHandler(true)
	payload, err := UnmarshalCommitComment(b)
	if err != nil {
		log.Println("Error decoding Commit Comment payload:", err)
		return
	}

	gu := payload.Comment.User
	gr := payload.Repo
	o := payload.Organization

	user, _ := entities.NewUserWithGithubData(gu)
	repo, _ := entities.NewRepoWithGithubData(gr)
	org, _ := entities.NewOrganizationWithGithubData(o)

	err = DistributeScores(points.COMMENT, user, repo, org)
	if err != nil {
		log.Println("Error distributing scores:", err)
	}
	RegisterAction(COMMMIT_COMMENT, user)
}