@gen.coroutine
  def _RepairBadCoverPhoto(self, viewpoint, ep_photos_list, activities):
    # Build dictionary of shared posts for looking up posts by PostId:
    shared_posts = {Post.ConstructPostId(post.episode_id, post.photo_id) : post
                    for _, _, posts, _ in ep_photos_list
                    for post in posts if not post.IsRemoved()}

    # This assumes that the activities list was generated from a forward scan query so we reverse it here.
    cover_photo = yield gen.Task(viewpoint.SelectCoverPhoto,
                                 self._client,
                                 set(),
                                 activities_list=reversed(activities),
                                 available_posts_dict=shared_posts)
    viewpoint.cover_photo = cover_photo
    yield gen.Task(viewpoint.Update, self._client)
    logging.warning('  updating cover_photo: %s, %s', viewpoint.viewpoint_id, cover_photo)
Select a new cover photo for this viewpoint.  Or clear it if none are available.
dataset/ETHPy150Open viewfinderco/viewfinder/backend/db/tools/dbchk.py/DatabaseChecker._RepairBadCoverPhoto