Browse Source

Merge pull request '改了一个bug' (#5) from fix_save into develop

Reviewed-on: #5
pull/6/head
zhangxin 3 years ago
parent
commit
b3b25f42cb
1 changed files with 37 additions and 29 deletions
  1. +37
    -29
      web/models/c_surveysheet_result.go

+ 37
- 29
web/models/c_surveysheet_result.go View File

@ -534,7 +534,7 @@ type CourtJoinResult struct {
}
// 满意度统计
func (c *CSurveysheetResult) Statistic(selectType string,year string,unit string) (result StatisticData, err error) {
func (c *CSurveysheetResult) Statistic(selectType string, year string, unit string) (result StatisticData, err error) {
engine := db.MasterEngine()
engine.ShowSQL(true)
query := engine.Table("c_surveysheet_resultlst").Join("LEFT", "c_surveysheet_result", "c_surveysheet_resultlst.cid = c_surveysheet_result.cid and c_surveysheet_resultlst.surveynr = c_surveysheet_result.surveynr")
@ -554,23 +554,23 @@ func (c *CSurveysheetResult) Statistic(selectType string,year string,unit string
return result, err
}
yearstr := date.Year()
if utils.ValueToInt(year,0) != yearstr{
if utils.ValueToInt(year, 0) != yearstr {
continue
}
month := int(date.Month())
if unit == "top"{
if month >6{
if unit == "top" {
if month > 6 {
continue
}
}else if unit == "bottom"{
if month <= 6{
} else if unit == "bottom" {
if month <= 6 {
continue
}
}else {
} else {
}
cate := joinResult.CSurveysheetSubjectlst.SubjectCategoryid
if cate == "整体满意程度" || cate == ""{
if cate == "整体满意程度" || cate == "" {
continue
}
cateMap[cate] = append(cateMap[cate], joinResult)
@ -649,7 +649,7 @@ func (c *CSurveysheetResult) Statistic(selectType string,year string,unit string
return result, err
}
yearstr := date.Year()
if utils.ValueToInt(year,0) != yearstr{
if utils.ValueToInt(year, 0) != yearstr {
continue
}
month := int(date.Month())
@ -660,16 +660,16 @@ func (c *CSurveysheetResult) Statistic(selectType string,year string,unit string
innerTimeType = "年中"
}
if unit == "top"{
if unit == "top" {
innerTimeType = "年末"
if month >6{
if month > 6 {
continue
}
}else if unit == "bottom"{
if month <= 6{
} else if unit == "bottom" {
if month <= 6 {
continue
}
}else {
} else {
}
if joinResult.CSurveysheetSubjectlst.SubjectCategoryid == "" {
@ -886,19 +886,19 @@ func (c *CSurveysheetResult) Statistic(selectType string,year string,unit string
return result, err
}
yearstr := date.Year()
if utils.ValueToInt(year,0) != yearstr{
if utils.ValueToInt(year, 0) != yearstr {
continue
}
month := int(date.Month())
if unit == "top"{
if month >6{
if unit == "top" {
if month > 6 {
continue
}
}else if unit == "bottom"{
if month <= 6{
} else if unit == "bottom" {
if month <= 6 {
continue
}
}else {
} else {
}
buildingDescr := joinResult.Buildingtab.Descr
@ -1083,7 +1083,11 @@ func (c *CSurveysheetResult) Statistic(selectType string,year string,unit string
if selectType == "ratio" {
// 处理整体满意度的表格
result.Total.SatisfactionPercent = utils.Decimal(float64(result.Total.ASum+result.Total.BSum)/float64(result.Total.Count), 3)
if result.Total.Count > 0 {
result.Total.SatisfactionPercent = utils.Decimal(float64(result.Total.ASum+result.Total.BSum)/float64(result.Total.Count), 3)
} else {
result.Total.SatisfactionPercent = 0
}
// 处理饼图数据
result.PicTotal.Row = []string{"非常满意", "满意", "一般", "不满意", "非常不满意"}
result.PicTotal.ValueLi = []float64{totalData.APercent, totalData.BPercent, totalData.CPercent, totalData.DPercent, totalData.EPercent}
@ -1121,7 +1125,7 @@ func (c *CSurveysheetResult) Statistic(selectType string,year string,unit string
if subjectData.Count == 0 {
subjectData.SatisfactionPercent = 0
} else {
subjectData.SatisfactionPercent = utils.Decimal(subjectData.APercent + subjectData.BPercent, 3)
subjectData.SatisfactionPercent = utils.Decimal(subjectData.APercent+subjectData.BPercent, 3)
}
data.SubjectStaticDataLi[innerIndex] = subjectData
}
@ -1189,7 +1193,11 @@ func (c *CSurveysheetResult) Statistic(selectType string,year string,unit string
*三分比例法:3分比例法统计的是选择非常满意满意一般的人数占比,此三项加和作为分母
**************/
// 处理整体满意度的表格
result.Total.SatisfactionPercent = result.Total.APercent + result.Total.BPercent + result.Total.CPercent
if result.Total.Count > 0 {
result.Total.SatisfactionPercent = utils.Decimal(float64(result.Total.ASum+result.Total.BSum+result.Total.CSum)/float64(result.Total.Count), 3)
} else {
result.Total.SatisfactionPercent = 0
}
// 处理饼图数据
result.PicTotal.Row = []string{"非常满意", "满意", "一般", "不满意", "非常不满意"}
result.PicTotal.ValueLi = []float64{totalData.APercent, totalData.BPercent, totalData.CPercent, totalData.DPercent, totalData.EPercent}
@ -1471,19 +1479,19 @@ func (c *CSurveysheetResult) AllStatistic(selectType string, cids []string, year
return result, err
}
yearstr := date.Year()
if utils.ValueToInt(year,0) != yearstr{
if utils.ValueToInt(year, 0) != yearstr {
continue
}
month := int(date.Month())
if unit == "top"{
if month >6{
if unit == "top" {
if month > 6 {
continue
}
}else if unit == "bottom"{
if month <= 6{
} else if unit == "bottom" {
if month <= 6 {
continue
}
}else {
} else {
}


Loading…
Cancel
Save