fix(assessment): return confirmed categories with their basis and label demonstration categories
This commit is contained in:
1 parent
623d41b969
commit
d4903a3796
77 files changed
+1441
-288
No files matched your search
@@ -176,6 +176,9 @@ type CandidateViewConfirmedCategoryInput struct {
|
||||
Specialization SpecializationCode
|
||||
Grade GradeCode
|
||||
Strength CandidateViewConfirmationStrength
|
||||
// Basis says what the grade rests on. It is required: a category without
|
||||
// a basis would read as a real confirmation.
|
||||
Basis AssessmentCategorySource
|
||||
}
|
||||
|
||||
type candidateViewStackClaim struct {
|
||||
@@ -228,12 +231,15 @@ func CandidateViewProfileFromContent(content CandidateProfileContent) CandidateV
|
||||
return profile
|
||||
}
|
||||
|
||||
// CandidateViewCategory is the category and coarse strength shown only when
|
||||
// categories were explicitly included in the publication.
|
||||
// CandidateViewCategory is the category, its coarse strength, and its basis,
|
||||
// shown only when categories were explicitly included in the publication.
|
||||
// The field order matches CandidateViewConfirmedCategoryInput so that the two
|
||||
// convert into each other.
|
||||
type CandidateViewCategory struct {
|
||||
Specialization SpecializationCode `json:"specialization"`
|
||||
Grade GradeCode `json:"grade"`
|
||||
Strength CandidateViewConfirmationStrength `json:"strength"`
|
||||
Basis AssessmentCategorySource `json:"basis"`
|
||||
}
|
||||
|
||||
// CandidateViewSelfAssessment is a candidate-declared specialization and
|
||||
@@ -381,7 +387,8 @@ func IsCandidateViewPseudonym(value string) bool {
|
||||
func validateCandidateViewConfirmations(confirmations []CandidateViewConfirmedCategoryInput) error {
|
||||
seen := make(map[SpecializationCode]struct{}, len(confirmations))
|
||||
for _, confirmation := range confirmations {
|
||||
if !confirmation.Specialization.IsKnown() || !confirmation.Grade.IsKnown() || !confirmation.Strength.IsKnown() {
|
||||
if !confirmation.Specialization.IsKnown() || !confirmation.Grade.IsKnown() || !confirmation.Strength.IsKnown() ||
|
||||
!confirmation.Basis.IsKnown() {
|
||||
return ErrInvalidAnonymousCandidateView
|
||||
}
|
||||
if _, duplicate := seen[confirmation.Specialization]; duplicate {
|
||||
|
||||
Reference in new issue
Block a user