Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[209] Submission Stats #280

Merged
merged 17 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/views/phases/_submissions_stats.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
Total Submissions
</h3>
<p class="usa-summary-box__text text-primary-darker text-bold">
Evaluations due by <%= @phase.evaluation_form.closing_date.strftime('%m/%d/%Y') %>
Evaluations due by <%= if @phase.evaluation_form then @phase.evaluation_form.closing_date.strftime('%m/%d/%Y') end %>
stonefilipczak marked this conversation as resolved.
Show resolved Hide resolved
</p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ CREATE TABLE public.submissions (
description_delta text,
brief_description_delta text,
pdf_reference character varying(255),
comments text
comments character varying
);


Expand Down
13 changes: 13 additions & 0 deletions spec/requests/submissions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@
get submissions_phase_path(phase)
expect(response).to have_http_status(:not_found)
end

it "renders submission statistics" do
submission = create(:submission, challenge: challenge, phase: phase)
submission_2 = create(:submission, challenge: challenge, phase: phase, judging_status: "selected")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint/UselessAssignment

Suggested change
submission = create(:submission, challenge: challenge, phase: phase)
submission_2 = create(:submission, challenge: challenge, phase: phase, judging_status: "selected")
create(:submission, challenge: challenge, phase: phase)
create(:submission, challenge: challenge, phase: phase, judging_status: "selected")



get submissions_phase_path(phase)
expect(response.body).to include("Boston Tea Party Cleanup")
# total submissions
expect(response.body).to include("2")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not testing much since the expect below also has a 2 in it, but I found a way to use css selectors that gives more specific expectations. the trick is to include Capybara::RSpecMatchers in the request specs to enable the have_css() matcher. I'll add this now.

# selected to advance
expect(response.body).to include("1 of 2")
end
end

context "when logged in as an evaluator" do
Expand Down
1 change: 1 addition & 0 deletions spec/system/submissions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
visit submissions_phase_path(phase)
expect(user.role).to eq("challenge_manager")
expect(page).to have_content("Boston Tea Party Cleanup")
expect(page).to have_content("Total Submissions")
expect(page).to(be_axe_clean)
end
end
Expand Down
Loading