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

fix: Property label showed in schema changed form #1091

Merged
merged 1 commit into from
Feb 27, 2024

Conversation

yaraslau-kavaliou
Copy link
Contributor

@yaraslau-kavaliou yaraslau-kavaliou commented Nov 30, 2023

Ticket - https://oat-sa.atlassian.net/browse/REL-1370

Bug root cause:

  • Having string types instead of core_kernel_classes_Literal for literal values returning by getPropertiesValues method (in case of value itself is iterable)

How to test:

  • Set up environment with neo4j persistence enabled
  • Create a metadata property for item or test class
  • Go to another page
  • Return to the page with metadata editing
  • Property label has to be set in form's label field
    Screenshot from 2023-11-30 18-25-39

@yaraslau-kavaliou yaraslau-kavaliou force-pushed the fix/REL-1370/property-lable-in-change-schema-form branch 2 times, most recently from f99f4f7 to 77b9037 Compare December 11, 2023 08:54
@yaraslau-kavaliou yaraslau-kavaliou force-pushed the fix/REL-1370/property-lable-in-change-schema-form branch from 77b9037 to d8a9f48 Compare December 11, 2023 08:58
Copy link

Version

Target Version 15.34.1
Last version 15.34.0

There are 0 BREAKING CHANGE, 0 feature, 1 fix

@yaraslau-kavaliou yaraslau-kavaliou changed the title fix: Property label showed in schema changed form for neo4j fix: Property label showed in schema changed form Jan 22, 2024
Copy link
Contributor

@vbyndych vbyndych left a comment

Choose a reason for hiding this comment

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

@yaraslau-kavaliou good work catching and fixing this issue. In general no anything blocking just a few things for a better look and feel.

@@ -639,4 +645,15 @@ private function buildTriplesFromNode(core_kernel_classes_ContainerCollection $t

return $tripleCollection;
}

private function formatValue($value, array $literalValueProcessingCallback = [])
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: can we use callable type hint here instead?

return common_Utils::isUri($value) ?
$this->getModel()->getResource($value)
: new core_kernel_classes_Literal(
!empty($literalValueProcessingCallback)
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: it would be more readable if we convert this ternary operator to nested IFs.

: new core_kernel_classes_Literal($this->getLanguageProcessor()->parseTranslatedValue($value));
$returnValue[$key][] = $this->formatValue(
$value,
[$this->getLanguageProcessor(), 'parseTranslatedValue']
Copy link
Contributor

Choose a reason for hiding this comment

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

question: do we need to check if a specific property is language-dependent before trying to apply regexp to trim it? I'm wondering as the regexp pattern could be costly on big chunks of text. Of course, it is a tradeoff here as calling check for language dependency will also cost something.

$returnValue[$key] ?? [],
$this->getLanguageProcessor()->filterByLanguage($value, [$dataLanguage, $defaultLanguage])
);
$returnValue[$key] =
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: could you consider refactoring this part (extracting method refactoring in particular) as it becomes a bit difficult to read?

@vbyndych
Copy link
Contributor

vbyndych commented Feb 5, 2024

Review Checklist

  • New code is covered by tests (if applicable)
  • Tests are running successfully (old and new ones) on my local machine (if applicable)
  • New code respects code style rules
  • New code respects best practices
  • Feature is working correctly on my local machine (if applicable)
  • Acceptance criteria are respected
  • Pull request title and description are meaningful
  • Pull request's target is not master
  • Commits are following conventional commits
  • Commits messages are meaningful
  • Commits are atomic

@augustas augustas merged commit 3bc2896 into develop Feb 27, 2024
5 of 6 checks passed
@augustas augustas deleted the fix/REL-1370/property-lable-in-change-schema-form branch February 27, 2024 12:24
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