diff --git a/dal/db_query/queries.sql b/dal/db_query/queries.sql index d5d6187..28e5dc3 100644 --- a/dal/db_query/queries.sql +++ b/dal/db_query/queries.sql @@ -539,7 +539,7 @@ WITH Funnel AS ( q.title AS question_title, a.content AS answer_content, CAST( - COUNT(CASE WHEN a.result = FALSE THEN 1 ELSE NULL END) * 100.0 / NULLIF(SUM(COUNT(CASE WHEN a.result = FALSE THEN 1 ELSE NULL END)) OVER (PARTITION BY q.id), 0) AS DECIMAL(10, 2) + COUNT(CASE WHEN a.result = FALSE THEN 1 ELSE NULL END) * 100.0 / NULLIF(SUM(COUNT(CASE WHEN a.result = FALSE THEN 1 ELSE NULL END)) OVER (PARTITION BY q.id), 0) AS FLOAT8 ) AS percentage FROM question q diff --git a/dal/sqlcgen/queries.sql.go b/dal/sqlcgen/queries.sql.go index 689939d..3fb82b9 100644 --- a/dal/sqlcgen/queries.sql.go +++ b/dal/sqlcgen/queries.sql.go @@ -1633,7 +1633,7 @@ WITH Funnel AS ( q.title AS question_title, a.content AS answer_content, CAST( - COUNT(CASE WHEN a.result = FALSE THEN 1 ELSE NULL END) * 100.0 / NULLIF(SUM(COUNT(CASE WHEN a.result = FALSE THEN 1 ELSE NULL END)) OVER (PARTITION BY q.id), 0) AS DECIMAL(10, 2) + COUNT(CASE WHEN a.result = FALSE THEN 1 ELSE NULL END) * 100.0 / NULLIF(SUM(COUNT(CASE WHEN a.result = FALSE THEN 1 ELSE NULL END)) OVER (PARTITION BY q.id), 0) AS FLOAT8 ) AS percentage FROM question q @@ -1680,7 +1680,7 @@ type QuestionsStatisticsRow struct { ResultsPercentage int32 `db:"results_percentage" json:"results_percentage"` QuestionsTitle string `db:"questions_title" json:"questions_title"` AnswerContent sql.NullString `db:"answer_content" json:"answer_content"` - QuestionsPercentage string `db:"questions_percentage" json:"questions_percentage"` + QuestionsPercentage float64 `db:"questions_percentage" json:"questions_percentage"` } func (q *Queries) QuestionsStatistics(ctx context.Context, arg QuestionsStatisticsParams) ([]QuestionsStatisticsRow, error) {