Query timestamp for adding pullreq event entries

Switch to querying the timestamp instead of ext_ref_id
to avoid inserting duplicate history entries in the case
duplicate entries exist in MongoDB. It is also more logical
to query the timestamp, as for a single pull request
only one event of the same status can happen per time instance.
Fix table names for retrieving comments for pullreqs