Earlier on in the migration, the update of the user directory query was erroneously switched to use post creation date instead of the date the post was solved.
This commit fixes that.
There are three locations where a user's solution query is defined
- user summary
- user card
- user directory
This PR updates the queries to use data from the new `SolvedTopics` table instead of the `UserActions` table. And adds testssssss
We are seeing some errors when migrating and adding indexes on `answer_post_id`.
```
#<StandardError:"An error has occurred, all later migrations canceled:\n\nPG::UniqueViolation: ERROR: could not create unique index \"index_discourse_solved_solved_topics_on_answer_post_id\"\nDETAIL: Key (answer_post_id)=(13006) is duplicated.\n">
```
This PR modifies the earlier migration, and also adds one before the addition of indexes to remove duplicates.
c.f. de983796e1b66aa2ab039a4fb6e32cec8a65a098
There will soon be additional login_required checks
for Guardian, and the intent of many checks by automated
systems is better fulfilled by using BasicUser, which
simulates a logged in TL0 forum user, rather than an
anon user.