8000 Custom screens : Sorting takes into account emoticones whereas it should not (#8239) by vlo-rte · Pull Request #8467 · opfab/operatorfabric-core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Custom screens : Sorting takes into account emoticones whereas it should not (#8239) #8467

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

vlo-rte
Copy link
Contributor
@vlo-rte vlo-rte commented Jun 4, 2025

Copy link
coderabbitai bot commented Jun 4, 2025
📝 Walkthrough

Walkthrough

A custom comparator function was added to the ag-grid configuration in the CustomCardListComponent by updating the defaultColDef object to include a comparator property. This comparator uses the compareObj method from the imported Utilities module to compare cell values. The Utilities module was imported from a relative path. No changes were made to exported or public entity declarations, and no other logic or control flow was modified.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vlo-rte vlo-rte changed the title Custom screens : Sorting takes into account emoticones whereas it sho… Custom screens : Sorting takes into account emoticones whereas it should not (#8239) Jun 4, 2025
Copy link
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
ui/main/src/app/views/customCardList/resultTable/ResultTable.ts (1)

40-40: Consider initializing comparator as undefined instead of empty object.

Initializing comparator as an empty object {} seems unnecessary since it gets overwritten for STRING fields and remains unused for other field types. This could be confusing to maintainers.

Consider this approach:

-                    comparator: {}
+                    comparator: undefined

Or simply omit the property initialization and only set it when needed in the switch statement.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b753acf and 039974c.

📒 Files selected for processing (1)
  • ui/main/src/app/views/customCardList/resultTable/ResultTable.ts (3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
ui/main/src/app/views/customCardList/resultTable/ResultTable.ts (1)
ui/main/src/app/utils/Utilities.ts (1)
  • Utilities (14-114)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: build
🔇 Additional comments (2)
ui/main/src/app/views/customCardList/resultTable/ResultTable.ts (2)

16-16: Import addition looks good.

The import of Utilities is correctly added and necessary for the new emoji-aware sorting functionality.


95-99: Emoji-aware comparator implementation is correct.

The implementation properly addresses the PR objective by using Utilities.compareObj which removes emojis before string comparison. The comparator function signature correctly matches AgGrid's expected interface.

This change ensures that emoticons are excluded from sorting as intended, fixing the issue described in #8239.

@vlo-rte vlo-rte force-pushed the FE-8239-CustomScreensSortingTakesIntoAccountEmoticonesWhereasItShouldNot branch 2 times, most recently from b1169bc to 36c06b9 Compare June 4, 2025 13:53
…uld not (#8239)

Signed-off-by: vlo-rte <valerie.longa@rte-france.com>
@vlo-rte vlo-rte force-pushed the FE-8239-CustomScreensSortingTakesIntoAccountEmoticonesWhereasItShouldNot branch from 36c06b9 to fa6a6c0 Compare June 4, 2025 13:54
Copy link
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b1169bc and fa6a6c0.

📒 Files selected for processing (1)
  • ui/main/src/app/components/customCardList/CustomCardListComponent.ts (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
ui/main/src/app/components/customCardList/CustomCardListComponent.ts (1)
ui/main/src/app/utils/Utilities.ts (1)
  • Utilities (14-114)
🔇 Additional comments (1)
ui/main/src/app/components/customCardList/CustomCardListComponent.ts (1)

48-48: Import statement looks correct.

The import of Utilities from the relative path is properly added to support the emoji-aware sorting functionality.

Comment on lines +275 to +278
wrapText: false,
comparator: function (valueA: any, valueB: any) {
return Utilities.compareObj(valueA, valueB);
}
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Emoji-aware sorting successfully implemented for default columns.

The addition of the custom comparator using Utilities.compareObj correctly addresses the issue where emoticons were affecting sort order. This will ensure consistent sorting behavior by removing emojis before comparison.

However, verify that other column types with custom comparators don't also need emoji-aware sorting:


🏁 Script executed:

#!/bin/bash
# Description: Check if other column types might contain emoji-susceptible content
# Expected: Find column types that might benefit from emoji-aware sorting

echo "=== Checking column types with custom comparators that might need emoji handling ==="
echo

echo "1. TypeOfState comparator (lines 318-326):"
sed -n '318,326p' ui/main/src/app/components/customCardList/CustomCardListComponent.ts

echo -e "\n2. Responses comparator (lines 351-361):"
sed -n '351,361p' ui/main/src/app/components/customCardList/CustomCardListComponent.ts

echo -e "\n3. HTML comparator (lines 289-299):"
sed -n '289,299p' ui/main/src/app/components/customCardList/CustomCardListComponent.ts

echo -e "\n=== Searching for potential emoji usage in data sources ==="
rg -i "emoji|emoticon|🎯|⚠️" --type ts

Length of output: 4290


Ensure emoji-aware sorting in all custom comparators

The default comparator now uses Utilities.compareObj, but the other custom comparators still perform direct string comparisons and will mis-order emoji-prefixed values. Please update the following to use Utilities.compareObj (or removeEmojis) on the relevant fields:

• ui/main/src/app/components/customCardList/CustomCardListComponent.ts
– Lines 289–299 (HTML comparator: replace if (rowValueA < rowValueB)… with return Utilities.compareObj(rowValueA, rowValueB))
– Lines 318–326 (TypeOfState comparator: replace text comparisons with return Utilities.compareObj(valueA.text, valueB.text))
– Lines 351–361 (Responses comparator: replace response string comparisons with return Utilities.compareObj(responseA, responseB))

By consolidating all comparators on Utilities.compareObj, we’ll guarantee consistent, emoji-agnostic sort order across every column.

🤖 Prompt for AI Agents
In ui/main/src/app/components/customCardList/CustomCardListComponent.ts at lines
289-299, 318-326, and 351-361, the custom comparators currently use direct
string comparisons which do not handle emoji-aware sorting. Replace the existing
comparison logic in these comparators with calls to Utilities.compareObj on the
relevant values (rowValueA and rowValueB for the HTML comparator, valueA.text
and valueB.text for the TypeOfState comparator, and responseA and responseB for
the Responses comparator) to ensure consistent emoji-agnostic sorting across all
columns.

Copy link
sonarqubecloud bot commented Jun 4, 2025

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.

Custom screens : Sorting takes into account emoticones whereas it should not
1 participant
0