Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
The RAMP event name.
team_name : str
The name of the team.
Returns
-------
event : :class:`ramp_database.model.Event`
The queried Event.
team : :class:`ramp_database.model.Team`
The queried team.
event_team : :class:`ramp_database.model.EventTeam`
The relationship event-team table.
"""
event = select_event_by_name(session, event_name)
team = select_team_by_name(session, team_name)
event_team = select_event_team_by_name(session, event_name, team_name)
if event_team is None:
event_team = EventTeam(event=event, team=team)
session.add(event_team)
session.commit()
return event, team, event_team
The team associated to the submission.
submission_name : str
The name to give to the current submission.
submission_path : str
The path of the files associated to the current submission. It will
corresponds to the key `ramp_kit_subissions_dir` of the dictionary
created with :func:`ramp_utils.generate_ramp_config`.
Returns
-------
submission : :class:`ramp_database.model.Submission`
The newly created submission.
"""
event = select_event_by_name(session, event_name)
team = select_team_by_name(session, team_name)
event_team = select_event_team_by_name(session, event_name, team_name)
submission = (session.query(Submission)
.filter(Submission.name == submission_name)
.filter(Submission.event_team == event_team)
.one_or_none())
# create a new submission
if submission is None:
all_submissions = (session.query(Submission)
.filter(Submission.event_team == event_team)
.order_by(Submission.submission_timestamp)
.all())
last_submission = None if not all_submissions else all_submissions[-1]
# check for non-admin user if they wait enough to make a new submission
if (team.admin.access_level != 'admin' and last_submission is not None
and last_submission.is_not_sandbox):
time_to_last_submission = (datetime.datetime.utcnow() -
Parameters
----------
session : :class:`sqlalchemy.orm.Session`
The session to directly perform the operation on the database.
event_name : str
The RAMP event name.
team_name : str
The name of the team.
Returns
-------
is_signed_up : bool
Whether or not the user is signed up for the event.
"""
event_team = select_event_team_by_name(session, event_name, user_name)
if (event_team is not None and
(event_team.is_active and event_team.approved)):
return True
return False
Parameters
----------
session : :class:`sqlalchemy.orm.Session`
The session to directly perform the operation on the database.
event_name : str
The RAMP event name.
team_name : str
The name of the team.
Returns
-------
event_team : :class:`ramp_database.model.EventTeam`
The event/team instance queried.
"""
return select_event_team_by_name(session, event_name, user_name)
Parameters
----------
session : :class:`sqlalchemy.orm.Session`
The session to directly perform the operation on the database.
event_name : str
The RAMP event name.
team_name : str
The name of the team.
Returns
-------
asked : bool
Whether or not the user had asked to join event or not.
"""
event_team = select_event_team_by_name(session, event_name, user_name)
if (event_team is not None and
(event_team.is_active and not event_team.approved)):
return True
return False