update repo method

This commit is contained in:
Pavel 2024-03-17 19:52:29 +03:00
parent 0dd33625c7
commit 20d0e1d127
2 changed files with 2 additions and 10 deletions

@ -517,10 +517,7 @@ WITH Funnel AS (
SELECT
q.title AS question_title,
ta.total_answers,
CASE
WHEN ta.total_answers = 0 THEN 0
ELSE CAST(COUNT(*)::FLOAT / NULLIF(ta.total_answers, 0) AS INTEGER)
END AS percentage
CAST(COUNT(*) * 100.0 / NULLIF(ta.total_answers, 0) AS INTEGER) AS percentage
FROM
answer a
JOIN
@ -542,10 +539,7 @@ WITH Funnel AS (
q.id,
q.title AS question_title,
a.content AS answer_content,
CASE
WHEN q.total_answers = 0 THEN 0
ELSE CAST(COUNT(*)::FLOAT / NULLIF(q.total_answers, 0) AS INTEGER)
END AS percentage
CAST(COUNT(*) * 100.0 / NULLIF(q.total_answers, 0) AS INTEGER) AS percentage
FROM
answer a
JOIN (

@ -3,7 +3,6 @@ package statistics
import (
"context"
"database/sql"
"fmt"
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/dal/sqlcgen"
"time"
)
@ -136,7 +135,6 @@ func (r *StatisticsRepository) GetQuestionsStatistics(ctx context.Context, req D
resp.Funnel[2] = float64(row.CountTResult) / float64(row.CountStartTrue)
}
fmt.Println(resp.Funnel)
resp.Results[row.ResultsTitle] = float64(row.ResultsPercentage)
if resp.Questions[row.QuestionsTitle] == nil {