Skip to content

fix(prescription): require at least one prescription on doctor submit - #477

Open
gkbishnoi07 wants to merge 1 commit into
angular-zard-migrationfrom
fix/prescription-mandatory-doctor
Open

fix(prescription): require at least one prescription on doctor submit#477
gkbishnoi07 wants to merge 1 commit into
angular-zard-migrationfrom
fix/prescription-mandatory-doctor

Conversation

@gkbishnoi07

Copy link
Copy Markdown

Addresses the prescription part of issue 14 from the MMU-UI QA testing doc: the prescription section is non-mandatory but should be mandatory for the doctor.

Background

The doctor "at least one prescription" gate was removed during the migration (commit 2a4bbf0) to match the old app, which did not require a prescription. QA/mentor confirmed it should be mandatory, so this restores the gate.

Change

In workarea-validation.service.ts, restore the prescription-required check on the doctor submit paths:

  • standard doctor submit (checkNurseRequirements, the shared validator)
  • quick-consult doctor flow (checkQuickConsultDoctorData)

Both are gated on attendantType === 'doctor', so the nurse flow is unchanged. The check reads patientCaseRecordForm.drugPrescriptionForm.prescribedDrugs, keeps only rows with a createdBy (every drug added via addMedicine() sets createdBy to the logged-in user, so template/empty rows are excluded), and if none remain it adds "Please add at least one prescription" to the mandatory-fields list, blocking submit.

To verify

  • As a doctor, try to submit with no prescription added -> submit is blocked with the mandatory message.
  • Add a medicine, then submit -> passes.
  • As a nurse -> no change.

restore the doctor prescription-required gate in the workarea validation
(standard submit + quick-consult paths) so a doctor cannot submit without
adding a prescription. gated on attendantType === 'doctor', so the nurse
flow is unchanged. added drug rows carry createdBy, so the presence check
counts real prescriptions only.
@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: a38acf8b-b3df-48e3-96bc-89c740835cda

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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.

1 participant