Skip to content

Commit

Permalink
validation, blank LocalId/PSI; UG validation refinement
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed May 15, 2017
1 parent 71ad394 commit d85a1a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 8 additions & 3 deletions napval/dobservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func (dob *DOBService) HandleMessage(req *lib.NiasMessage) ([]lib.NiasMessage, e
} else {

yrlvl := rr.YearLevel
tstlvl := rr.TestLevel
desc := ""
field := "BirthDate"
ok := true
Expand All @@ -105,9 +106,9 @@ func (dob *DOBService) HandleMessage(req *lib.NiasMessage) ([]lib.NiasMessage, e
case yrlvl == "P":
// log.Println("student is primary")
desc = "Year level supplied is P, does not match expected test level " + rr.TestLevel
field = field + "/TestLevel"
field = field + "/YearLevel"
ok = false
case strings.Contains(yrlvl, "UG"):
case strings.Contains(yrlvl, "UG") && tstlvl != dob.calculateYearLevel(t):
// log.Println("student is ungraded")
desc = "Year level supplied is UG, will result in SRM warning flag for test level " + rr.TestLevel
field = field + "/TestLevel/YearLevel"
Expand All @@ -124,6 +125,11 @@ func (dob *DOBService) HandleMessage(req *lib.NiasMessage) ([]lib.NiasMessage, e
field = field + "/YearLevel"
ok = false
severity = "warning"
case yrlvl != tstlvl:
desc = "Year Level " + yrlvl + " does not match Test level " + tstlvl
field = field + "/TestLevel"
ok = false
severity = "warning"
default:
field = "BirthDate"
if yrlvl != "" && yrlvl != dob.calculateYearLevel(t) {
Expand All @@ -133,7 +139,6 @@ func (dob *DOBService) HandleMessage(req *lib.NiasMessage) ([]lib.NiasMessage, e
ok = false
severity = "warning"
}
tstlvl := rr.TestLevel
if tstlvl != "" && tstlvl != dob.calculateYearLevel(t) {
// log.Println("Student is in wrong test level: ", tstlvl)
desc = "Student Test Level (yr " + tstlvl + ") does not match year level derived from BirthDate (yr " + dob.calculateYearLevel(t) + ")"
Expand Down
6 changes: 3 additions & 3 deletions napval/idservice3.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,14 @@ func (ids *IDService3) HandleMessage(req *lib.NiasMessage) ([]lib.NiasMessage, e
//log.Printf("simplekey: %s\nsimplekey2: %s\ncompllexkey: %s", simpleKey1, simpleKey2, complexKey)
var simpleRecordExists1, simpleRecordExists2, complexRecordExists bool

if simpleRecordExists1 = tids.SimpleKeysLocalId.Has(simpleKey1); !simpleRecordExists1 {
if simpleRecordExists1 = tids.SimpleKeysLocalId.Has(simpleKey1) && len(rr.LocalId) > 0; !simpleRecordExists1 {
tids.SimpleKeysLocalId.Add(simpleKey1)
}
if simpleRecordExists2 = tids.SimpleKeysPSI.Has(simpleKey2); !simpleRecordExists2 {
if simpleRecordExists2 = tids.SimpleKeysPSI.Has(simpleKey2) && len(platformid) > 0; !simpleRecordExists2 {
tids.SimpleKeysPSI.Add(simpleKey2)
}

if complexRecordExists = tids.ExtendedKeys.Has(complexKey); !complexRecordExists {
if complexRecordExists = tids.ExtendedKeys.Has(complexKey) && len(rr.LocalId) > 0; !complexRecordExists {
tids.ExtendedKeys.Add(complexKey)
}
tids.Locations.SetIfAbsent(simpleKey1, req.SeqNo)
Expand Down

0 comments on commit d85a1a0

Please sign in to comment.