-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[WEB-3049] fix: Resolve start and end date comparison issue in cycle create and update #6333
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
Conversation
WalkthroughThe pull request introduces modifications to date comparison logic across multiple files in the cycle-related serializers and views. The changes primarily focus on improving the way start and end dates are compared by explicitly converting them to strings before comparison. This ensures more consistent and predictable date validation across the application's cycle-related components. Changes
Sequence DiagramsequenceDiagram
participant Serializer
participant View
Serializer->>Serializer: Convert start_date to string
Serializer->>Serializer: Convert end_date to string
Serializer->>View: Compare dates
View->>View: Validate date equality
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
🔭 Outside diff range comments (1)
apiserver/plane/app/serializers/cycle.py (1)
Line range hint
109-109: Fix missing comma in read_only_fields list.There's a missing comma between
"cycle"and"user"in the read_only_fields list, which will cause a syntax error.- read_only_fields = ["workspace", "project", "cycle" "user"] + read_only_fields = ["workspace", "project", "cycle", "user"]
🧹 Nitpick comments (2)
apiserver/plane/app/serializers/cycle.py (1)
25-27: Simplify the boolean expression for date comparison.Similar to the API serializer, this boolean expression can be simplified.
- True - if str(data.get("start_date")) == str(data.get("end_date")) - else False + str(data.get("start_date")) == str(data.get("end_date"))apiserver/plane/app/views/cycle/base.py (1)
538-538: Good fix for the string literal comparison, but simplify the boolean expression.The change correctly fixes the comparison of actual date values instead of string literals. However, the boolean expression can be simplified.
- True if str(start_date) == str(end_date) else False + str(start_date) == str(end_date)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
apiserver/plane/api/serializers/cycle.py(1 hunks)apiserver/plane/app/serializers/cycle.py(1 hunks)apiserver/plane/app/views/cycle/base.py(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: lint-apiserver
- GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
apiserver/plane/api/serializers/cycle.py (1)
35-37: Simplify the boolean expression and consider using native date comparison.The current implementation converts dates to strings for comparison, which might mask potential timezone or date format issues. Consider these improvements:
- Simplify the boolean expression
- Use native date comparison if possible
- True - if str(data.get("start_date")) == str(data.get("end_date")) - else False + str(data.get("start_date")) == str(data.get("end_date"))Let's verify if there are any timezone-related issues that necessitated the string comparison:
Description
start_dateandend_dateduring cycle creation and updates.Type of Change
References
[WEB-3049]
Summary by CodeRabbit
CycleUserPropertiesSerializerby adding a missing comma inread_only_fields