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

Review work history gaps #7347

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Review work history gaps #7347

wants to merge 5 commits into from

Conversation

ddippolito
Copy link
Contributor

Trello card URL

https://trello.com/c/EoVximLZ/1436-review-work-history-gaps-and-link-error-messaging-to-each-gap

Changes in this PR:

Split error messages in the working history gaps page.

Screenshots of UI changes:

Before

Screenshot 2024-12-12 at 16 17 34

After

Screenshot 2024-12-12 at 16 16 52 Screenshot 2024-12-12 at 16 17 08

@ddippolito ddippolito force-pushed the review-work-history-gaps branch from 7d9cee7 to 25864a1 Compare December 12, 2024 17:17
Copy link

Review app deployed to https://teaching-vacancies-review-pr-7347.test.teacherservices.cloud on AKS

Comment on lines 57 to 64
attributes[:unexplained_employment_gaps] = job_application.unexplained_employment_gaps if step == :employment_history

if step == :professional_status
attributes.merge(jobseeker_profile_attributes)
.merge(trn_params)
else
attributes
attributes.merge!(jobseeker_profile_attributes)
.merge!(trn_params)
end

attributes
Copy link
Contributor

@starswan starswan Dec 12, 2024

Choose a reason for hiding this comment

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

IMHO it's bad practice for a function to modify its input parameters, hence the original non-destructive version

@@ -1,21 +1,25 @@
class Jobseekers::JobApplication::EmploymentHistoryForm < Jobseekers::JobApplication::BaseForm
include ActiveModel::Model
include ActionView::Helpers::DateHelper
Copy link
Contributor

@starswan starswan Dec 12, 2024

Choose a reason for hiding this comment

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

this feels like view code in the model layer. It would be more idiomatic to add an error which is then rendered later?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need access to distance_of_time_in_words; hence, I need to add this here. Also, consider this is a form model.


context "when employment history gaps are present" do
it "adds errors for each unexplained gap" do
form.valid?
Copy link
Contributor

Choose a reason for hiding this comment

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

the idiom here to to assert that the form isn't valid, which then allows the errors to be asserted afterwards rather than this hanging valid? call

let(:unexplained_employment_gaps_present) { "false" }

it "does not add errors for gaps" do
form.valid?
Copy link
Contributor

Choose a reason for hiding this comment

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

expect(form).to be_valid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants