refactor sample station + loading

This commit is contained in:
2024-05-27 15:14:44 +07:00
parent 44eca754f5
commit ac4feb51c1
7 changed files with 699 additions and 58 deletions

View File

@@ -76,13 +76,14 @@ func (ss *MDSampleStationServices) GetListSampleStation(search string, currentPa
if err := dbx.Handlex.Select(&sampleStationList, query, prm, prm, rowPerPage, offset); err != nil {
return nil, 0, fmt.Errorf("error query database: %v", err)
}
totalPage := int(math.Ceil(float64(totalData) / float64(rowPerPage)))
for _, d := range sampleStationList {
if len(d.T_SampleStationIsNonLab) == 0 {
d.T_SampleStationIsNonLab = "Lab"
for i := range sampleStationList {
if len(sampleStationList[i].T_SampleStationIsNonLab) == 0 {
sampleStationList[i].T_SampleStationIsNonLab = "LAB"
}
}
totalPage := int(math.Ceil(float64(totalData) / float64(rowPerPage)))
return sampleStationList, totalPage, nil
}