Skip to content

Commit

Permalink
rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
stonefilipczak committed Nov 7, 2024
1 parent 6ee60fe commit 3ac1bcd
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
7 changes: 3 additions & 4 deletions app/controllers/manage_submissions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@ def index
def show
@submission = Submission.find(params[:id])
end

def update
@submission = Submission.find(params[:id])

if @submission.update!(submission_params)
flash.now[:success] = "Comments saved."
flash.now[:success] = I18n.t("comments_saved")
render :show, submission: @submission
else
flash.now[:error] = "Unable to save comments."
render :show, status: :unprocessable_entity, submission: @submission
end
end
end

def by_challenge_phase
@phase = Phase.where(id: params[:phase_id],
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/manage_submissions_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ def selected_to_advance?(submission)

def assigned_to_user?(user, submission)
submission.challenge_id.in?(user.challenge_manager_challenges.collect(&:id))
end
end
end
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ en:
already_logged_in_notice: "You are already logged in."
evaluation_form_destroyed: "Evaluation form was successfully destroyed."
evaluation_form_saved: "Evaluation form was saved successfully."
comments_saved: "Comments saved succesfully."
login_error: "There was an issue with logging in. Please try again."
please_try_again: "Please try again."
session_expired_alert: "Your session has expired. Please log in again."
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/submission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
association :challenge
association :phase
association :submitter, factory: :user
# don't think we need this anymore?
# don't think we need this anymore?
# association :manager, factory: :user

title { Faker::Lorem.sentence }
Expand Down
6 changes: 3 additions & 3 deletions spec/requests/manage_submissions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,16 @@
expect(response.body).to include(submission.id.to_s)
expect(response.body).to include(submission.brief_description)
end

it "does not render submission details for a challenge the user is not assigned to" do
challenge = create_challenge()
challenge = create_challenge
phase = create_phase(challenge_id: challenge.id)
submission = create(:submission, challenge: phase.challenge, brief_description: "This submission has teeth.")

get manage_submission_path(submission)
expect(response.body).not_to include(submission.brief_description)
expect(response.body).to include("You are not assigned to manage this submission.")
end
end
end

context "when logged in as an evaluator" do
Expand Down

0 comments on commit 3ac1bcd

Please sign in to comment.