style: use camelCase for JSON

Sorry if you're using another convention.
I'm aligning us with OAS.
main v0.2.2
Dominique Merle 3 years ago
parent c5b7cffd87
commit a5e3ef1a98

@ -13,18 +13,18 @@ package judgment
// Not sure about that. Is it worth the hassle? May change. Advice welcome.
//
// ProposalAnalysis holds some of the data we need to compute the Score of a Proposal, and hence its Rank.
// ProposalAnalysis holds some data we need to compute the Score of a Proposal, and hence its Rank.
type ProposalAnalysis struct {
TotalSize uint64 // total amount of judges|judgments across all grades
MedianGrade uint8 // 0 == "worst" grade, goes up to the amount of grades minus one
MedianGroupSize uint64 // in judges|judgments
SecondMedianGrade uint8 // used in Majority Judgment deliberation
SecondGroupSize uint64 // either adhesion or contestation, whichever is bigger (contestation prevails)
SecondGroupSign int // -1 for contestation group, +1 for adhesion group
AdhesionGroupGrade uint8
AdhesionGroupSize uint64
ContestationGroupGrade uint8
ContestationGroupSize uint64
TotalSize uint64 `json:"totalSize"` // total amount of judges|judgments across all grades
MedianGrade uint8 `json:"medianGrade"` // 0 == "worst" grade, goes up to the amount of grades - 1
MedianGroupSize uint64 `json:"medianGroupSize"` // in judges|judgments
SecondMedianGrade uint8 `json:"secondMedianGrade"` // used in Majority Judgment deliberation
SecondGroupSize uint64 `json:"secondGroupSize"` // either adhesion or contestation, whichever is bigger
SecondGroupSign int `json:"secondGroupSign"` // -1 for contestation group, +1 for adhesion group
AdhesionGroupGrade uint8 `json:"adhesionGroupGrade"`
AdhesionGroupSize uint64 `json:"adhesionGroupSize"`
ContestationGroupGrade uint8 `json:"contestationGroupGrade"`
ContestationGroupSize uint64 `json:"contestationGroupSize"`
// Can't decide between Rebuttal and Contestation… Help!
//RebuttalGroupGrade uint8
//RebuttalGroupSize uint64

@ -2,16 +2,16 @@ package judgment
// PollResult holds the result for each proposal, in the original proposal order, or sorted by Rank.
type PollResult struct {
Proposals ProposalsResults // matches the order of the input proposals' tallies
ProposalsSorted ProposalsResults // same Results, but sorted by Rank this time
Proposals ProposalsResults `json:"proposals"` // matches the order of the input proposals' tallies
ProposalsSorted ProposalsResults `json:"proposalsSorted"` // same Results, but sorted by Rank this time
}
// ProposalResult holds the computed Rank for a proposal, as well as analysis data.
type ProposalResult struct {
Index int // index of the proposal in the input proposals' tallies. Useful with ProposalSorted
Rank int // Rank starts at 1 (best) and goes upwards. Equal Proposals share the same rank.
Score string // higher lexicographically → better rank
Analysis *ProposalAnalysis
Index int `json:"index"` // Index of the proposal in the input proposals' tallies. Useful with ProposalSorted
Rank int `json:"rank"` // Rank starts at 1 (best) and goes upwards. Equal Proposals share the same rank.
Score string `json:"score"` // higher lexicographically → better rank
Analysis *ProposalAnalysis `json:"analysis"`
}
// ProposalsResults implements sort.Interface based on the Score field.

@ -6,8 +6,8 @@ import (
// PollTally describes the amount of judgments received by each proposal on each grade.
type PollTally struct {
AmountOfJudges uint64 // Helps balancing tallies using default judgments.
Proposals []*ProposalTally // Tallies of each proposal. Its order is preserved in the result.
AmountOfJudges uint64 `json:"amountOfJudges"` // Helps balancing tallies using default judgments.
Proposals []*ProposalTally `json:"proposals"` // Tallies of each proposal. Its order is preserved in the result.
}
// GuessAmountOfJudges also mutates the PollTally by filling the AmountOfJudges property
@ -48,7 +48,7 @@ func (pollTally *PollTally) BalanceWithMedianDefault() (err error) {
// ProposalTally holds the amount of judgments received per Grade for a single Proposal
type ProposalTally struct {
Tally []uint64 // Amount of judgments received for each grade, from "worst" grade to "best" grade.
Tally []uint64 `json:"tally"` // Amount of judgments received for each grade, from "worst" grade to "best" grade.
}
// Analyze a ProposalTally and return its ProposalAnalysis

Loading…
Cancel
Save