Use cyclist emoji instead of red cross for pending deliveries#490
Use cyclist emoji instead of red cross for pending deliveries#490
Conversation
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@lib/bike_brigade/slack_api/payload_builder.ex`:
- Around line 181-182: The helper delivery_status_icon/1 currently maps every
non-:completed status to :bicyclist:, which wrongly shows :failed and :removed
as active; update the delivery_status_icon function to pattern-match the actual
DeliveryStatusEnum variants (e.g. :completed, :failed, :removed, and the
specific pending/in-progress atoms used in lib/bike_brigade/delivery/task.ex) so
that terminal states like :failed and :removed return distinct icons (e.g. :x:
or :no_entry:) while only pending/in-progress statuses return :bicyclist:,
keeping delivery_status_icon/1 exhaustive and explicit.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1e730dea-b1c7-4b9f-8398-34e660371835
📒 Files selected for processing (1)
lib/bike_brigade/slack_api/payload_builder.ex
| defp delivery_status_icon(:completed), do: ":white_check_mark:" | ||
| defp delivery_status_icon(_), do: ":x:" | ||
| defp delivery_status_icon(_), do: ":bicyclist:" |
There was a problem hiding this comment.
Avoid showing failed/removed deliveries as active cyclists.
Line 182 now maps every non-:completed status to :bicyclist:. Since DeliveryStatusEnum also includes :failed and :removed in lib/bike_brigade/delivery/task.ex:12-18, those states will be displayed as active/in-progress deliveries rather than failed/removed. Consider matching only pending/in-progress statuses explicitly and preserving distinct icons for terminal non-completed states.
🚴 Proposed status-specific mapping
defp delivery_status_icon(:completed), do: ":white_check_mark:"
-defp delivery_status_icon(_), do: ":bicyclist:"
+defp delivery_status_icon(:pending), do: ":bicyclist:"
+defp delivery_status_icon(:picked_up), do: ":bicyclist:"
+defp delivery_status_icon(:failed), do: ":x:"
+defp delivery_status_icon(:removed), do: ":no_entry_sign:"As per coding guidelines, “This is an Elixir/Phoenix application. Review for Elixir best practices, proper use of pattern matching, and Phoenix context boundaries.”
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| defp delivery_status_icon(:completed), do: ":white_check_mark:" | |
| defp delivery_status_icon(_), do: ":x:" | |
| defp delivery_status_icon(_), do: ":bicyclist:" | |
| defp delivery_status_icon(:completed), do: ":white_check_mark:" | |
| defp delivery_status_icon(:pending), do: ":bicyclist:" | |
| defp delivery_status_icon(:picked_up), do: ":bicyclist:" | |
| defp delivery_status_icon(:failed), do: ":x:" | |
| defp delivery_status_icon(:removed), do: ":no_entry_sign:" |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@lib/bike_brigade/slack_api/payload_builder.ex` around lines 181 - 182, The
helper delivery_status_icon/1 currently maps every non-:completed status to
:bicyclist:, which wrongly shows :failed and :removed as active; update the
delivery_status_icon function to pattern-match the actual DeliveryStatusEnum
variants (e.g. :completed, :failed, :removed, and the specific
pending/in-progress atoms used in lib/bike_brigade/delivery/task.ex) so that
terminal states like :failed and :removed return distinct icons (e.g. :x: or
:no_entry:) while only pending/in-progress statuses return :bicyclist:, keeping
delivery_status_icon/1 exhaustive and explicit.
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="lib/bike_brigade/slack_api/payload_builder.ex">
<violation number="1" location="lib/bike_brigade/slack_api/payload_builder.ex:182">
P2: The catch-all `_` maps terminal failure states (`:failed`, `:removed`) to `:bicyclist:`, making them appear as active in-progress deliveries. Match pending/in-progress statuses explicitly and preserve distinct icons for failed/removed states.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
|
||
| defp delivery_status_icon(:completed), do: ":white_check_mark:" | ||
| defp delivery_status_icon(_), do: ":x:" | ||
| defp delivery_status_icon(_), do: ":bicyclist:" |
There was a problem hiding this comment.
P2: The catch-all _ maps terminal failure states (:failed, :removed) to :bicyclist:, making them appear as active in-progress deliveries. Match pending/in-progress statuses explicitly and preserve distinct icons for failed/removed states.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At lib/bike_brigade/slack_api/payload_builder.ex, line 182:
<comment>The catch-all `_` maps terminal failure states (`:failed`, `:removed`) to `:bicyclist:`, making them appear as active in-progress deliveries. Match pending/in-progress statuses explicitly and preserve distinct icons for failed/removed states.</comment>
<file context>
@@ -179,7 +179,7 @@ defmodule BikeBrigade.SlackApi.PayloadBuilder do
defp delivery_status_icon(:completed), do: ":white_check_mark:"
- defp delivery_status_icon(_), do: ":x:"
+ defp delivery_status_icon(_), do: ":bicyclist:"
def filter_mrkdwn(nil) do
</file context>
Describe your changes
Use cyclist emoji instead of red cross for pending deliveries
Summary
Replace the red cross with a cyclist emoji for pending deliveries in Slack campaign summaries.
Checklist before requesting a review
about this update in the description above.
Summary by cubic
Slack messages now show 🚴 for non-completed deliveries instead of ❌. This clarifies that pending or in-progress deliveries are active, not failed.
Written for commit 716da9f. Summary will update on new commits.
Summary by CodeRabbit