add device, browser etc to answers obtaining
This commit is contained in:
parent
208dcd8924
commit
5bd4114f60
@ -312,7 +312,7 @@ INSERT INTO answer(
|
|||||||
) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13);
|
) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13);
|
||||||
|
|
||||||
-- name: GetResultAnswers :many
|
-- name: GetResultAnswers :many
|
||||||
SELECT DISTINCT on (question_id) id, content, quiz_id, question_id, fingerprint, session,created_at, result, new,deleted FROM answer WHERE session = (
|
SELECT DISTINCT on (question_id) id, content, quiz_id, question_id, fingerprint, session,created_at, result, new,deleted, device_type,device,os,browser,ip FROM answer WHERE session = (
|
||||||
SELECT session FROM answer WHERE answer.id = $1) AND start = false ORDER BY question_id, created_at DESC;
|
SELECT session FROM answer WHERE answer.id = $1) AND start = false ORDER BY question_id, created_at DESC;
|
||||||
|
|
||||||
-- name: GetQuestions :many
|
-- name: GetQuestions :many
|
||||||
|
|||||||
@ -1341,7 +1341,7 @@ func (q *Queries) GetQuizHistory(ctx context.Context, arg GetQuizHistoryParams)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getResultAnswers = `-- name: GetResultAnswers :many
|
const getResultAnswers = `-- name: GetResultAnswers :many
|
||||||
SELECT DISTINCT on (question_id) id, content, quiz_id, question_id, fingerprint, session,created_at, result, new,deleted FROM answer WHERE session = (
|
SELECT DISTINCT on (question_id) id, content, quiz_id, question_id, fingerprint, session,created_at, result, new,deleted, device_type,device,os,browser,ip FROM answer WHERE session = (
|
||||||
SELECT session FROM answer WHERE answer.id = $1) AND start = false ORDER BY question_id, created_at DESC
|
SELECT session FROM answer WHERE answer.id = $1) AND start = false ORDER BY question_id, created_at DESC
|
||||||
`
|
`
|
||||||
|
|
||||||
@ -1356,6 +1356,11 @@ type GetResultAnswersRow struct {
|
|||||||
Result sql.NullBool `db:"result" json:"result"`
|
Result sql.NullBool `db:"result" json:"result"`
|
||||||
New sql.NullBool `db:"new" json:"new"`
|
New sql.NullBool `db:"new" json:"new"`
|
||||||
Deleted sql.NullBool `db:"deleted" json:"deleted"`
|
Deleted sql.NullBool `db:"deleted" json:"deleted"`
|
||||||
|
DeviceType string `db:"device_type" json:"device_type"`
|
||||||
|
Device string `db:"device" json:"device"`
|
||||||
|
Os string `db:"os" json:"os"`
|
||||||
|
Browser string `db:"browser" json:"browser"`
|
||||||
|
Ip string `db:"ip" json:"ip"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *Queries) GetResultAnswers(ctx context.Context, id int64) ([]GetResultAnswersRow, error) {
|
func (q *Queries) GetResultAnswers(ctx context.Context, id int64) ([]GetResultAnswersRow, error) {
|
||||||
@ -1378,6 +1383,11 @@ func (q *Queries) GetResultAnswers(ctx context.Context, id int64) ([]GetResultAn
|
|||||||
&i.Result,
|
&i.Result,
|
||||||
&i.New,
|
&i.New,
|
||||||
&i.Deleted,
|
&i.Deleted,
|
||||||
|
&i.DeviceType,
|
||||||
|
&i.Device,
|
||||||
|
&i.Os,
|
||||||
|
&i.Browser,
|
||||||
|
&i.Ip,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -240,6 +240,11 @@ func (r *ResultRepository) GetResultAnswers(ctx context.Context, answerID uint64
|
|||||||
CreatedAt: row.CreatedAt.Time,
|
CreatedAt: row.CreatedAt.Time,
|
||||||
New: row.New.Bool,
|
New: row.New.Bool,
|
||||||
Deleted: row.Deleted.Bool,
|
Deleted: row.Deleted.Bool,
|
||||||
|
Device: row.Device,
|
||||||
|
DeviceType: row.DeviceType,
|
||||||
|
OS: row.Os,
|
||||||
|
IP: row.Ip,
|
||||||
|
Browser: row.Browser,
|
||||||
}
|
}
|
||||||
|
|
||||||
answers = append(answers, answer)
|
answers = append(answers, answer)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user