def get(self): offset_id = int(self.get_argument("offset_id", 0)) results = tuple(Result.get_results(offset_id=offset_id)) self.render( "admin/overview/results.html", count=Result.get_count(), results=results, next_offset_id=results[-1]["id"] if results else 0, )
def get(self): args = {k: self.get_argument(k, default) for (k, default) in [('offset_id', 0), ('limit',1000), ('project_id',None)]} results = tuple(Result.get_results(**args)) self.render( 'admin/overview/results.html', count=Result.get_count() if args['project_id'] is None else 0, results=results, next_higher_offset_id=int(results[0]['id'])+int(args['limit']) if results else 0, next_lower_offset_id=int(results[-1]['id'])-1 if results else 0, **args)
def has_results(args): bootstrap = Bootstrap() bootstrap.setup_args() bootstrap.parse_args(args=[args.config_path]) bootstrap.load_config() bootstrap.setup_database() if Result.has_results(): if args.min_batch_size: return Result.get_count() >= args.min_batch_size else: return True