diff --git a/repository/statistics/click_statistics.go b/repository/statistics/click_statistics.go index 9580e42..a786ea4 100644 --- a/repository/statistics/click_statistics.go +++ b/repository/statistics/click_statistics.go @@ -59,6 +59,24 @@ type Statistic struct { type PipeLineStatsResp [][]Statistic +// todo нужно исключить множества из подмножеств, пока что получаются все уникальные векторы респондентов по опросу +// пример: +//"[0, 116783, 116810]" +//"[0, 116783, 116798]" +//"[0, 116783, 116798, 116831]" +//"[0, 116783, 116810, 116849]" +//[0] +//"[0, 116783]" +//"[0, 116783, 116810, 116843]" + +//SELECT DISTINCT final FROM ( +//SELECT groupArray(ctxquestionid) AS final FROM (SELECT DISTINCT f.ctxsession, a.ctxquestionid +//FROM (SELECT ctxsession, max(event_time) AS max_time +//FROM statistics WHERE ctxquizid = 26276 GROUP BY ctxsession ) f +//JOIN ( SELECT ctxsession, ctxquestionid, event_time +//FROM statistics WHERE ctxquizid = 26276 ) a ON f.ctxsession = a.ctxsession) +//GROUP BY ctxsession); + func (s *StatisticClick) getFunnel(ctx context.Context, quizID int64, from uint64, to uint64) (map[int64][]string, error) { // берем из матвью все что принадлежит quizID в указанном интервале времени // выбираем самыые поздние по роу набер - 1