

def __check_expr_status(self, user, hackathon, template):
    '\n        check experiment status, if there are pre-allocate experiments, the experiment will be assigned directly\n        :param user:\n        :param hackathon:\n        :param template:\n        :return:\n        '
    criterion = Q(status__in=[EStatus.RUNNING, EStatus.STARTING], hackathon=hackathon, user=user)
    is_admin = self.admin_manager.is_hackathon_admin(hackathon.id, user.id)
    if is_admin:
        criterion &= Q(template=template)
    expr = Experiment.objects(criterion).first()
    if expr:
        return expr
    expr = Experiment.objects(status=EStatus.RUNNING, hackathon=hackathon, template=template, user=None).first()
    if expr:
        expr.user = criterion
        expr.save()
        return expr

dataset/ETHPy150Open msopentechcn/open-hackathon/open-hackathon-server/src/hackathon/expr/expr_mgr.py ExprManager.__check_expr_status/VarMisuse@135/234 `user`->`criterion`