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

PSP-9287 | Document type purpose / definition #4407

Merged
merged 10 commits into from
Oct 23, 2024

Conversation

FuriousLlama
Copy link
Collaborator

No description provided.

@FuriousLlama FuriousLlama added the enhancement New feature or request label Oct 19, 2024
@FuriousLlama FuriousLlama self-assigned this Oct 19, 2024
Copy link
Contributor

See CodeCov Report Here: https://app.codecov.io/github/bcgov/psp/pull/4407

Copy link
Contributor

See CodeCov Report Here: https://app.codecov.io/github/bcgov/psp/pull/4407

2 similar comments
Copy link
Contributor

See CodeCov Report Here: https://app.codecov.io/github/bcgov/psp/pull/4407

Copy link
Contributor

See CodeCov Report Here: https://app.codecov.io/github/bcgov/psp/pull/4407

@@ -55,6 +55,14 @@ export const SelectedDocumentHeader: React.FunctionComponent<ISelectedDocumentHe
[documentTypes],
);

const selectedDocumentType = useMemo(() => {
const documentType = documentTypes.find(d => Number(document.documentTypeId) === d.id);
Copy link
Collaborator

Choose a reason for hiding this comment

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

unrelated to these changes, but isn't the documentTypeId a number? at least I think it is on the backend.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it is, the problem is that on the form is a string.

@@ -55,6 +55,14 @@ export const SelectedDocumentHeader: React.FunctionComponent<ISelectedDocumentHe
[documentTypes],
);

const selectedDocumentType = useMemo(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: This variable appears to contain the purpose and not the document type

document_types = []

# Get the document Type
for i in range(2, doctype_sheet.nrows):
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: magic number(2)

doc_type_name = doctype_sheet.cell_value(i, 2)
doc_type_purpose = doctype_sheet.cell_value(i, 3)
# display_order = int(doctype_sheet.cell_value(i, 3))
display_order = 8
Copy link
Collaborator

Choose a reason for hiding this comment

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

?

metadata_types = []

# Get the document Type
for i in range(3, metadata_sheet.nrows):
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: magic number(3)

print("--------------" + str(i))
current_row_name = sheet.cell_value(i, 1)

if current_row_name != "":
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is this necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sometimes the document definition takes multiple rows, leaving the row name empty


doctype_sort_order = []

for i in range(3, sheet.nrows):
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: magic number(3)


def load_document_definitions():
# Give the location of the file
doctype_location = ("xml_definitions/doctype_definitions.xlsx")
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: perhaps a common function to get a file, open the workbook, extract the sheet, and possibly index to the first valid row? that would cut down on some of this duplicated code.

if current_row_name != "":
doc_type_name = current_row_name

if doc_type_name not in doctype_sort_order:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, we may want to throw here instead, I feel like I'd rather fail fast then accidentally generate a json with missing data.

@@ -0,0 +1,220 @@

Copy link
Collaborator

Choose a reason for hiding this comment

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

please either add some doc for this, or update the make file.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for adding this!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good idea. I will add a new pr with a readme

Copy link
Contributor

See CodeCov Report Here: https://app.codecov.io/github/bcgov/psp/pull/4407

1 similar comment
Copy link
Contributor

See CodeCov Report Here: https://app.codecov.io/github/bcgov/psp/pull/4407

@FuriousLlama FuriousLlama merged commit a459d60 into bcgov:dev Oct 23, 2024
7 checks passed
@FuriousLlama FuriousLlama changed the title PSP-9312 | Document type purpose / definition PSP-9287 | Document type purpose / definition Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants