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

UIQM-431 Marc record fixed field 008 with proper order. #602

Merged
merged 4 commits into from
Oct 3, 2023

Conversation

przemyslawturek
Copy link
Contributor

@przemyslawturek przemyslawturek commented Sep 29, 2023

Set marc fixed field 008 based on api specification with proper order of subfields.

Issue

UIQM-431

Approach

Using API for marc specification according to MODQM-332
Set fixed field 008 with proper order of subfields.
Changes applies to field 008 for bibliographic / holding / authority records

Extra

Adding hints with full name of subfield edited in fixed fields 006/007/008

Screen and Screencast

Before
Before_UIQM-431
After UIQM-431

2023-09-29-15-10-08.mp4

Learning

Pre-Merge Checklist

Before merging this PR, please go through the following list and take appropriate actions.

  • I've added appropriate record to the CHANGELOG.md
  • Does this PR meet or exceed the expected quality standards?
    • Code coverage on new code is 80% or greater
    • Duplications on new code is 3% or less
    • There are no major code smells or security issues
  • Does this introduce breaking changes?
    • If any API-related changes - okapi interfaces and permissions are reviewed/changed correspondingly
    • There are no breaking changes in this PR.

If there are breaking changes, please STOP and consider the following:

  • What other modules will these changes impact?
  • Do JIRAs exist to update the impacted modules?
    • If not, please create them
    • Do they contain the appropriate level of detail? Which endpoints/schemas changed, etc.
    • Do they have all they appropriate links to blocked/related issues?
  • Are the JIRAs under active development?
    • If not, contact the project's PO and make sure they're aware of the urgency.
  • Do PRs exist for these changes?
    • If so, have they been approved?

Ideally all of the PRs involved in breaking changes would be merged in the same day to avoid breaking the folio-testing environment. Communication is paramount if that is to be achieved, especially as the number of intermodule and inter-team dependencies increase.

While it's helpful for reviewers to help identify potential problems, ensuring that it's safe to merge is ultimately the responsibility of the PR assignee.

Depends of marc specifications api for fixed field 008.
@BogdanDenis
Copy link
Contributor

Hey @przemyslawturek, could you add to the description a screencast of the feature please?

@przemyslawturek
Copy link
Contributor Author

Ok - sure

@@ -292,7 +293,7 @@ const QuickMarcEditorRows = ({
isRequestToCentralTenantFromMember,
onCheckCentralTenantPerm,
);
const canBeLinkedAuto = isRecordForAutoLinking(recordRow, autoLinkableBibFields);
const canBeLinkedAuto = isRecordForAutoLinking(recordRow, autoLinkableBibFields) || false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need additional || false if the returned value will be either true or falsy value?

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 don't remember why I do this :)

return (typeOK && subTypeOK);
};

marcSpec.spec.types.forEach((marcType, indexType) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer to avoid indexes and use find method instead


const fixedFieldType = marcSpec.spec.types.find((fixedFieldType) => {
  return fixedFieldRype.identifiedBy.or.some((fieldIdentifier) => {
    return fieldIdentifier.tag === LEADER_TAG && checkTypeSubType(fieldIdentifier);
  });
});

return fixedFieldType;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice and clean - ok

@@ -39,6 +39,7 @@ const propTypes = {
location: ReactRouterPropTypes.location.isRequired,
locations: PropTypes.object.isRequired,
marcType: PropTypes.oneOf(Object.values(MARC_TYPES)).isRequired,
marcSpec: PropTypes.object.isRequired,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think marcSpec prop name is a little confusing. Without knowing what it is I though it was a general MARC file specification, but it's just for Fixed Fields. Let's rename all it's uses to fixedFieldSpec

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I had doubt too with this name


return FixedField ? <FixedField name={name} /> : null;
getDocumentType(marcSpec, type, subtype) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the method name is a little misleading, because we're returning Fixed Field type for Leader\06 and Leader\07 values
Let's rename to getFixedFieldType


it('should create correct document type', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Also I think fixed field type would be better name than document type

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@@ -57,6 +57,10 @@ jest.mock('../../queries', () => ({
sourceFiles: [],
isLoading: false,
}),
useMarcSpecifications: jest.fn().mockReturnValue({
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably this can be removed because there's no hook like this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah - forget to remove - thanks

Made changes as suggested
@github-actions
Copy link

github-actions bot commented Oct 2, 2023

Jest Unit Test Statistics

    1 files  ±0    40 suites  ±0   1m 40s ⏱️ ±0s
338 tests +1  338 ✔️ +1  0 💤 ±0  0 ±0 
339 runs  +1  339 ✔️ +1  0 💤 ±0  0 ±0 

Results for commit 5e53527. ± Comparison against base commit b28eaa4.

♻️ This comment has been updated with latest results.

BytesField,
} from '../BytesField';

const BibliographicFixedField = ({ name, config }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think with the new implementation this separation between BibliographicFixedField, AuthorityFixedField and HoldingsFixedField components is not needed - they have the same api and the field configuration is coming from back-end so we can have just one FixedField component

Replace Bibliographic, Authority, Holdings FixedField to one FixedField
Refactory getFixedField without marcType
Removed unnecessary tests, fixed current without using the marcType props
@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 3, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

98.9% 98.9% Coverage
5.9% 5.9% Duplication

warning The version of Java (11.0.17) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more here

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@przemyslawturek przemyslawturek merged commit 2e8a25f into master Oct 3, 2023
3 of 4 checks passed
@przemyslawturek przemyslawturek deleted the UIQM-431 branch October 4, 2023 08:51
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