update repo method
This commit is contained in:
parent
0dd33625c7
commit
20d0e1d127
@ -517,10 +517,7 @@ WITH Funnel AS (
|
|||||||
SELECT
|
SELECT
|
||||||
q.title AS question_title,
|
q.title AS question_title,
|
||||||
ta.total_answers,
|
ta.total_answers,
|
||||||
CASE
|
CAST(COUNT(*) * 100.0 / NULLIF(ta.total_answers, 0) AS INTEGER) AS percentage
|
||||||
WHEN ta.total_answers = 0 THEN 0
|
|
||||||
ELSE CAST(COUNT(*)::FLOAT / NULLIF(ta.total_answers, 0) AS INTEGER)
|
|
||||||
END AS percentage
|
|
||||||
FROM
|
FROM
|
||||||
answer a
|
answer a
|
||||||
JOIN
|
JOIN
|
||||||
@ -542,10 +539,7 @@ WITH Funnel AS (
|
|||||||
q.id,
|
q.id,
|
||||||
q.title AS question_title,
|
q.title AS question_title,
|
||||||
a.content AS answer_content,
|
a.content AS answer_content,
|
||||||
CASE
|
CAST(COUNT(*) * 100.0 / NULLIF(q.total_answers, 0) AS INTEGER) AS percentage
|
||||||
WHEN q.total_answers = 0 THEN 0
|
|
||||||
ELSE CAST(COUNT(*)::FLOAT / NULLIF(q.total_answers, 0) AS INTEGER)
|
|
||||||
END AS percentage
|
|
||||||
FROM
|
FROM
|
||||||
answer a
|
answer a
|
||||||
JOIN (
|
JOIN (
|
||||||
|
@ -3,7 +3,6 @@ package statistics
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
|
||||||
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/dal/sqlcgen"
|
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/dal/sqlcgen"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -136,7 +135,6 @@ func (r *StatisticsRepository) GetQuestionsStatistics(ctx context.Context, req D
|
|||||||
resp.Funnel[2] = float64(row.CountTResult) / float64(row.CountStartTrue)
|
resp.Funnel[2] = float64(row.CountTResult) / float64(row.CountStartTrue)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println(resp.Funnel)
|
|
||||||
resp.Results[row.ResultsTitle] = float64(row.ResultsPercentage)
|
resp.Results[row.ResultsTitle] = float64(row.ResultsPercentage)
|
||||||
|
|
||||||
if resp.Questions[row.QuestionsTitle] == nil {
|
if resp.Questions[row.QuestionsTitle] == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user