Skip to content

FLCRM-18391: Properly handle date-formated calculation field conversions#87

Closed
Jirles wants to merge 17 commits intomainfrom
FLCRM-18391/properly-handle-date-calc-field-conversions
Closed

FLCRM-18391: Properly handle date-formated calculation field conversions#87
Jirles wants to merge 17 commits intomainfrom
FLCRM-18391/properly-handle-date-calc-field-conversions

Conversation

@Jirles
Copy link
Contributor

@Jirles Jirles commented Jul 23, 2025

What

  • Convert date value to double before constructing the query object

Why

FLCRM-18391

The bug in the ticket is caused by a mismatch between the display format of this Calculated fields (Date) and the underlying data value (double). Since there wasn't any conversion to handle this mismatch properly in fulcrm-query-sql, the resulting SQL filter was something along the lines of WHERE 'calc_field' BETWEEN '07-15-2025' AND '07-20-2025'. This returned nothing because of the type mismatch.

Testing

  • Go to the associated PR in the fulcrum repo and log into the Design organization using the credentials in 1Pass.
  • There should be an app called Calculated Date Filtering in the XXXX org.
  • Navigate to the data viewer and filter the calculated field column using the Filter by Condition menu.

@Jirles Jirles requested a review from a team as a code owner July 23, 2025 14:59
@gitstream-cm
Copy link

gitstream-cm bot commented Jul 23, 2025

🚨 gitStream Monthly Automation Limit Reached 🚨

Your organization has exceeded the number of pull requests allowed for automation with gitStream.
Monthly PRs automated: 250/250

To continue automating your PR workflows and unlock additional features, please contact LinearB.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @Jirles, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical bug in the fulcrum-query-sql library concerning the handling of date-formatted calculated fields. Previously, these fields were not correctly converted to their underlying numeric timestamp values during query object construction, leading to SQL type mismatches and failed queries. The changes introduce the necessary conversion logic within the Converter class and include new unit tests to ensure the proper transformation of date values into their numeric equivalents, thereby enabling accurate query generation.

Highlights

  • Date Conversion Fix: Implemented a crucial conversion within the Converter class to correctly transform date-formatted calculated field values into their underlying numeric (Unix timestamp) representation. This resolves a bug where type mismatches prevented proper query construction for these fields.
  • Enhanced Test Coverage: Added a dedicated unit test case for the ConstValue converter to specifically validate the new date-to-timestamp conversion logic for calculated fields, ensuring its correctness and preventing regressions.
  • Version Update: The package version has been incremented from 1.1.13 to 1.1.14 to reflect these changes.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses a bug where date-formatted calculation fields were not being converted correctly, leading to failing SQL queries. The fix involves converting the date string to a numeric timestamp before building the query, and new tests have been added to validate this behavior. My review focuses on improving the robustness of this conversion. I've suggested using the existing moment.js dependency for more reliable date parsing and adding checks for invalid dates to prevent potential database errors. I also recommended expanding the test suite to cover more date formats as mentioned in the associated JIRA ticket.

@Jirles Jirles closed this Jul 24, 2025
@Jirles
Copy link
Contributor Author

Jirles commented Jul 24, 2025

started using this for testing, not going to try to merge this

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.

1 participant