Skip to content
This repository was archived by the owner on May 9, 2022. It is now read-only.

User Progress Histogram Reliability #925

Open
jsharkey13 opened this issue Feb 7, 2018 · 0 comments
Open

User Progress Histogram Reliability #925

jsharkey13 opened this issue Feb 7, 2018 · 0 comments

Comments

@jsharkey13
Copy link
Member

The user progress histogram on the My Progress page is currently not a reliable indicator of behaviour:
image
It is very easy to make it look impressive by answering the same question incorrectly hundreds of times. It also hits the log events table, which is perilously slow sometimes.
We can move to using the question attempts table, and only showing unique correct attempts. This gives a much more reliable indication of activity and cannot be cheated easily.

WITH first_correct_attempts AS
    (SELECT question_id, min(timestamp) AS timestamp
     FROM question_attempts WHERE user_id=? AND correct GROUP BY question_id)
SELECT to_char(gen_month, 'YYYY-MM-01'), count(question_id)
FROM generate_series(date_trunc('month', ?::timestamp), ?, INTERVAL '1' MONTH) m(gen_month)
LEFT OUTER JOIN first_correct_attempts ON ( date_trunc('month', timestamp) = date_trunc('month', gen_month) )
GROUP BY gen_month
ORDER BY gen_month ASC;

This will benefit from an additional index on the question_attempts table:

CREATE INDEX question_attempt_timestamp
ON public.question_attempts USING btree ("timestamp");

I'm unsure where this should go in the API though, presumably the QuestionManager, rather than the LogManager that is currently used?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant