app/jobs/assignment_repo/create_github_repository_job.rb
# Create an AssignmentRepo
#
# assignment - The Assignment that will own the AssignmentRepo
# user       - The User that the AssignmentRepo will belong to
# retries    - The number of times the job will automatically retry
#
# rubocop:disable MethodLength
# rubocop:disable AbcSize
Create an AssignmentRepo
assignment - The Assignment that will own the AssignmentRepo
user       - The User that the AssignmentRepo will belong to
retries    - The number of times the job will automatically retry


Create an AssignmentRepo assignment - The Assignment that will own the AssignmentRepo user - The User that the AssignmentRepo will belong to retries - The number of times the job will automatically retry
def perform(assignment, user, retries: 0)
      start = Time.zone.now
      invite_status = assignment.invitation.status(user)
      return unless invite_status.waiting?
      invite_status.creating_repo!
      broadcast_message(
        message: CREATE_REPO,
        assignment: assignment,
        user: user,
        invite_status: invite_status,
        status_text: CREATE_REPO.chomp(".")
      )
      create_assignment_repo(assignment, user)
      report_time(start)
      GitHubClassroom.statsd.increment("v2_exercise_repo.create.success")
      if assignment.starter_code?
        invite_status.importing_starter_code!
        broadcast_message(
          message: IMPORT_STARTER_CODE,
          assignment: assignment,
          user: user,
          invite_status: invite_status,
          status_text: "Import started"
        )
        GitHubClassroom.statsd.increment("exercise_repo.import.started")
      else
        invite_status.completed!
        broadcast_message(
          message: Creator::REPOSITORY_CREATION_COMPLETE,
          assignment: assignment,
          user: user,
          invite_status: invite_status,
          status_text: "Completed"
        )
      end
    rescue Creator::Result::Error => err
      handle_error(err, assignment, user, invite_status, retries)
    end
def perform ( assignment , user , retries : 0 ) start = Time . zone . now invite_status = assignment . invitation . status ( user ) return unless invite_status . waiting? invite_status . creating_repo! broadcast_message ( message : CREATE_REPO , assignment : assignment , user : user , invite_status : invite_status , status_text : CREATE_REPO . chomp ( "." ) ) create_assignment_repo ( assignment , user ) report_time ( start ) GitHubClassroom . statsd . increment ( "v2_exercise_repo.create.success" ) if assignment . starter_code? invite_status . importing_starter_code! broadcast_message ( message : IMPORT_STARTER_CODE , assignment : assignment , user : user , invite_status : invite_status , status_text : "Import started" ) GitHubClassroom . statsd . increment ( "exercise_repo.import.started" ) else invite_status . completed! broadcast_message ( message : Creator :: REPOSITORY_CREATION_COMPLETE , assignment : assignment , user : user , invite_status : invite_status , status_text : "Completed" ) end rescue Creator :: Result :: Error => err handle_error ( err , assignment , user , invite_status , retries ) end
Create an AssignmentRepo
assignment - The Assignment that will own the AssignmentRepo
user       - The User that the AssignmentRepo will belong to
retries    - The number of times the job will automatically retry
Create an AssignmentRepo assignment - The Assignment that will own the AssignmentRepo user - The User that the AssignmentRepo will belong to retries - The number of times the job will automatically retry
assignment
<not_specific>
user
<not_specific>
retries
<not_specific>