Skip to content

Doctor question model crud - #180

Open
wanderworld1000-create wants to merge 3 commits into
ruby-for-good-2026from
doctor-question-model-crud
Open

Doctor question model crud#180
wanderworld1000-create wants to merge 3 commits into
ruby-for-good-2026from
doctor-question-model-crud

Conversation

@wanderworld1000-create

Copy link
Copy Markdown
Collaborator

What this does

Add the MVC & rudimentary business logic for DoctorQuestions and DoctorQuestionTypes

Issue

Closes #165

Testing

  • [x ] Unit Tests
  • [x ] Manual testing Questions screen

@dpowers1 dpowers1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The migrations thing is the only blocker. This looks really good!!

@@ -0,0 +1,11 @@
class CreateDoctorQuestions < ActiveRecord::Migration[8.1]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could we roll these 3 migrations on the doctor_questions table into 1?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Ack. Done.

@doctor_questions = DoctorQuestion.sorted_by(params[:sort], params[:direction])
end


Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

rm extra newline

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Ack. Removed.

@@ -0,0 +1,2 @@
module DoctorQuestionTypesHelper

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We can rm this file

Comment thread app/models/doctor_question.rb Outdated

# Whitelist. Never interpolate a query parameter into an ORDER BY: anything
# not in this hash falls back to the default rather than reaching SQL, which
# is what makes the Arel.sql below safe to write.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

NIT: Probably dont need this comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Ack. Reduced to one line.

Comment thread db/seeds.rb Outdated

questions.each do |question|
type.doctor_questions.find_or_create_by!(question: question)
end

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Adding the raw data to the seed here isn't incorrect but something to consider would to be spliting this into its own file and loading all seeds programmatically. Some reading on the subject https://medium.com/@ethanryan/split-your-rails-seeds-file-into-separate-files-in-different-folders-3c57be765818

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Ack. Updated.

@wanderworld1000-create

Copy link
Copy Markdown
Collaborator Author

Posting a new commit with changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants