code: def collect_results(project, force=False):
      
      if not project.crawlable:
          return project
  
      now = datetime.datetime.now()
  
      if (now - project.updated_at).total_seconds() < 4 and (not force):
          return project
  
      result_paths = []
      if os.path.isdir(project.path_name):
          result_paths.extend(_list_result_paths(project.path_name))
  
      registered_results = db.session.query(Result.path_name).filter_by(
          project_id=project.id
      ).all()
      registered_paths = {r.path_name for r in registered_results}
  
      for result_path in result_paths:
          if result_path not in registered_paths:
              _register_result(project.id, result_path)
  
      project.updated_at = datetime.datetime.now()
  
      db.session.commit()
  
      return project
docs: collect_results.