FLCRM-18391: Properly handle date-formated calculation field conversions#87
FLCRM-18391: Properly handle date-formated calculation field conversions#87
Conversation
|
🚨 gitStream Monthly Automation Limit Reached 🚨 Your organization has exceeded the number of pull requests allowed for automation with gitStream. To continue automating your PR workflows and unlock additional features, please contact LinearB. |
There was a problem hiding this comment.
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
Converterclass 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
ConstValueconverter 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.13to1.1.14to 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
-
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. ↩
There was a problem hiding this comment.
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.
|
started using this for testing, not going to try to merge this |
What
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