Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+5 votes
524 views
in Plugins by

I need to determine when an answer was selected as best.

For upvotes, we can easily use: 

SELECT votecreated FROM `^uservotes` 
WHERE vote = 1  AND `postid` = #

But it seems the the a_select events are not stored separately.

Would it only be the qa_eventlog table?

Q2A version: 1.8.3

1 Answer

+3 votes
by
edited by

It is easy to get the date and time selected as the update information for the question. This is only available if the action immediately preceding a specific question is the best answer. This means that if a question is updated after an answer is selected, it can no longer be retrieved. As you think, if you don't create a new special process, I think there is no other way but to get it from the event log.

If you create a plugin, it is recommended that you create event plugin that fetches two events (a_select, a_unselect) rather than one that parses event log table. Because event log records what happened and does not assume that information will be reused.

Reference: https://docs.question2answer.org/plugins/modules-event/

by
edited by
And if the admin is not using the eventlog/event module, then there is no way to retrieve this information at all. There is no core implementation!

"Because event log records what happened and does not assume that information will be reused." - Exactly, that's why we need to store this information in a core DB. Opened an issue at https://github.com/q2a/question2answer/issues/767
...