Skip to content

Commit d7ac689

Browse files
committed
refactor: 불필요한 메서드 제거
1 parent 6f84efc commit d7ac689

File tree

2 files changed

+1
-33
lines changed

2 files changed

+1
-33
lines changed

app/report/services/report_service.go

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"gdsc/baro/global/fcm"
1212
"gdsc/baro/global/utils"
1313
"io"
14-
"math/rand"
1514
"os"
1615
"time"
1716

@@ -175,11 +174,7 @@ func ParseAnalysis(response *types.ResponseAnalysis) ([]int, []float64, string,
175174
angles = append(angles, response.LandmarksInfo[i].Angle)
176175
}
177176

178-
if len(response.LandmarksInfo) == 0 {
179-
return _CorrectionScore()
180-
} else {
181-
return result, scores, fmt.Sprintf("%.3f", nomalRatio), fmt.Sprintf("%v", statusFrequencies), fmt.Sprintf("%.3f", distances), fmt.Sprintf("%.3f", angles)
182-
}
177+
return result, scores, fmt.Sprintf("%.3f", nomalRatio), fmt.Sprintf("%v", statusFrequencies), fmt.Sprintf("%.3f", distances), fmt.Sprintf("%.3f", angles)
183178
}
184179

185180
func CalculateScores(result []int, scores []float64) string {
@@ -233,16 +228,6 @@ func CalculateScores(result []int, scores []float64) string {
233228
return fmt.Sprintf("%.2f", totalScore)
234229
}
235230

236-
func _CorrectionScore() ([]int, []float64, string, string, string, string) {
237-
res := []int{1}
238-
scores := []float64{70.3 + rand.Float64()*(98.5-70.3)}
239-
nomalRatio := 83.3 + rand.Float64()*(94.4-83.3)
240-
statusFrequencies := []int{7, 4, 3, 3}
241-
distances := []float64{2.0 + rand.Float64()*(3.2-2.0)}
242-
angles := []float64{143.8 + rand.Float64()*(170.25-143.8)}
243-
return res, scores, fmt.Sprintf("%.3f", nomalRatio), fmt.Sprintf("%v", statusFrequencies), fmt.Sprintf("%.3f", distances), fmt.Sprintf("%.3f", angles)
244-
}
245-
246231
func GenerateMessage(date string) (string, string, error) {
247232
timeFormats := []string{
248233
"2006-01-02 15:04:05.000 -0700 MST",

app/report/services/report_service_test.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -274,23 +274,6 @@ func TestParseAnalysis_FullStatusFrequencies(t *testing.T) {
274274
assert.Equal(t, fmt.Sprintf("%v", []string{"1", "2", "1", "2"}), statusFrequencies)
275275
}
276276

277-
func TestParseAnalysis_NoLandmarksInfo(t *testing.T) {
278-
// response *types.ResponseAnalysis
279-
response := types.ResponseAnalysis{
280-
Result: []int{},
281-
HunchedRatio: 10.0,
282-
NormalRatio: 90.0,
283-
Scores: []float64{},
284-
LandmarksInfo: []types.LandmarkInfo{},
285-
StatusFrequencies: map[string]int{"Fine": 1, "Danger": 2, "Serious": 1, "Very Serious": 2},
286-
}
287-
288-
result, _, _, statusFrequencies, _, _ := services.ParseAnalysis(&response)
289-
290-
assert.Equal(t, result, []int{1})
291-
assert.Equal(t, statusFrequencies, "[7 4 3 3]")
292-
}
293-
294277
func TestCalculateScores_AllBad(t *testing.T) {
295278
// Set up test data
296279
testResult := []int{0, 0, 0, 0, 0, 0}

0 commit comments

Comments
 (0)