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

Merge Develop into Staging #7540

Merged
merged 3 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
59 changes: 59 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Create Release on Branch Push

on:
push:
branches:
- production

permissions:
contents: write

jobs:
release:
name: Release on Push
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Necessary to fetch all tags

- name: Calculate next tag
id: calc_tag
run: |
YEAR=$(date +"%y")
WEEK=$(date +"%V")
LAST_TAG=$(git tag -l "v$YEAR.$WEEK.*" | sort -V | tail -n1)
LAST_TAG=$(echo "$LAST_TAG" | tr -d '\r' | sed 's/[[:space:]]*$//')
echo "Last Tag: $LAST_TAG"
if [[ $LAST_TAG == "" ]]; then
MINOR=0
else
MINOR=$(echo $LAST_TAG | awk -F '.' '{print $NF}')
echo "Minor Version: $MINOR"
MINOR=$((MINOR + 1))
fi
TAG="v$YEAR.$WEEK.$MINOR"
echo "TAG=$TAG" >> $GITHUB_ENV
echo "Next Tag: $TAG"

- name: Configure git
run: |
git config user.name github-actions
git config user.email [email protected]

- name: Create and push tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git tag -a "$TAG" -m "Release $TAG"
git push origin "$TAG"

- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "$TAG" \
--repo="$GITHUB_REPOSITORY" \
--title="$TAG" \
--generate-notes \
--draft
2 changes: 1 addition & 1 deletion cypress/pageobject/Patient/PatientCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class PatientPage {
}

typePatientDateOfBirth(dateOfBirth: string) {
cy.clickAndSelectOption("#patientAge", "D.O.B");
cy.clickAndSelectOption("#patientAge", "DOB");
cy.get("#date_of_birth").scrollIntoView();
cy.get("#date_of_birth").should("be.visible").click();
cy.get("#date-input").click().type(dateOfBirth);
Expand Down
3 changes: 2 additions & 1 deletion src/Components/DeathReport/DeathReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import TextFormField from "../Form/FormFields/TextFormField";
import TextAreaFormField from "../Form/FormFields/TextAreaFormField";
import DateFormField from "../Form/FormFields/DateFormField";
import PhoneNumberFormField from "../Form/FormFields/PhoneNumberFormField";
import { formatDateTime } from "../../Utils/utils";
import { formatDateTime, patientAgeInYears } from "../../Utils/utils";
import Page from "../Common/components/Page";
import Form from "../Form/Form";
import { useTranslation } from "react-i18next";
Expand Down Expand Up @@ -106,6 +106,7 @@ export default function PrintDeathReport(props: { id: string }) {
const patientComorbidities = getPatientComorbidities(res.data);
const data = {
...res.data,
age: patientAgeInYears(res.data!),
gender: patientGender,
address: patientAddress,
comorbidities: patientComorbidities,
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Form/SelectMenuV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const SelectMenuV2 = <T, V>(props: SelectMenuProps<T, V>) => {
{value.icon}
</div>
)}
<p className="ml-2.5 break-all text-sm font-medium">
<p className="ml-2.5 whitespace-nowrap break-all text-sm font-medium">
{value.selectedLabel}
</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Patient/PatientRegister.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,7 @@ export const PatientRegister = (props: PatientRegisterProps) => {
[
{
value: "date_of_birth",
text: "D.O.B.",
text: "DOB",
},
{ value: "age", text: "Age" },
] as const
Expand Down
14 changes: 14 additions & 0 deletions src/Utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,20 @@ const getRelativeDateSuffix = (abbreviated: boolean) => {
};
};

export const patientAgeInYears = (obj: PatientModel) => {
const start = dayjs(
obj.date_of_birth
? new Date(obj.date_of_birth)
: new Date(obj.year_of_birth!, 0, 1)
);

const end = dayjs(
obj.death_datetime ? new Date(obj.death_datetime) : new Date()
);

return end.diff(start, "years");
};

export const formatPatientAge = (obj: PatientModel, abbreviated = false) => {
const suffixes = getRelativeDateSuffix(abbreviated);

Expand Down
Loading