-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[WEB-2843] chore: updated the cycle end date logic #6194
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,7 @@ | |
| from plane.db.models import Cycle | ||
| from plane.app.permissions import WorkspaceViewerPermission | ||
| from plane.app.serializers.cycle import CycleSerializer | ||
|
|
||
| from plane.utils.timezone_converter import user_timezone_converter | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Remove unused import. The -from plane.utils.timezone_converter import user_timezone_converter🧰 Tools🪛 Ruff (0.8.2)13-13: Remove unused import: (F401) |
||
|
|
||
| class WorkspaceCyclesEndpoint(BaseAPIView): | ||
| permission_classes = [WorkspaceViewerPermission] | ||
|
|
||
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.
🛠️ Refactor suggestion
Consider additional error handling for date conversion
While the validation logic is sound, consider adding error handling for the
convert_to_utccalls which could raise exceptions if:if ( data.get("start_date", None) is not None and data.get("end_date", None) is not None ): project_id = self.initial_data.get("project_id") or self.instance.project_id - data["start_date"] = convert_to_utc( - str(data.get("start_date").date()), project_id, is_start_date=True - ) - data["end_date"] = convert_to_utc( - str(data.get("end_date", None).date()), project_id - ) + try: + data["start_date"] = convert_to_utc( + str(data.get("start_date").date()), project_id, is_start_date=True + ) + data["end_date"] = convert_to_utc( + str(data.get("end_date", None).date()), project_id + ) + except (Project.DoesNotExist, ValueError) as e: + raise serializers.ValidationError(f"Date conversion failed: {str(e)}")📝 Committable suggestion