作者 yangfu

部门长修改

... ... @@ -4,6 +4,7 @@ import (
"bytes"
"fmt"
"github.com/astaxie/beego/orm"
"gitlab.fjmaimaimai.com/mmm-go/gocomm/common"
"gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log"
"opp/internal/utils"
"opp/models"
... ... @@ -97,6 +98,7 @@ func GetTopDepartment(departments []*protocol.Department) *protocol.Department {
if len(departments) == 0 {
return &protocol.Department{}
}
log.Debug(common.AssertJson(departments))
var top *protocol.Department
var countTop, countTmp = 0, 0
for i := range departments {
... ... @@ -126,6 +128,7 @@ func GetTopDepartment(departments []*protocol.Department) *protocol.Department {
func GetTopPosition(positions []*protocol.Position) *protocol.Position {
var top *protocol.Position
var countTop, countTmp = 0, 0
log.Debug(common.AssertJson(positions))
if len(positions) == 0 {
return &protocol.Position{}
}
... ...
... ... @@ -25,7 +25,7 @@ func Test_GetTopDepartment(t *testing.T) {
},
}
out := GetTopDepartment(input)
if out.DepartmentId != 1 {
if out.DepartmentId != 5 {
t.Fatal("top department error")
}
}
... ...