Skip to content

Conversation

@OrangeAndGreen
Copy link
Contributor

https://dimagi.atlassian.net/browse/CCCT-897
cross-request: dimagi/commcare-core#1455

Product Description

Changed the displayed text in payment unit progress cards for special situations:

  • Final 2 days of delivery: showing "by today" and "by tomorrow"
  • Delivery ended: showing "Days Over"
  • All visits completed: showing "All Visits Done"

Technical Summary

Some additional logic and new strings to handle the additional displays.
Also saw a misidentified class that I should have change in a commit yesterday.
It was low-risk since all we call is setText and both classes implement the method the same way, but good to fix.

Feature Flag

Connect

Safety Assurance

Safety story

Tested display manually.

Automated test coverage

No automated tests for Connect yet.

QA Plan

Verify the text is displayed correctly for each of the scenarios described above.

Labels and Review

  • Do we need to enhance the manual QA test coverage ? If yes, the "QA Note" label is set correctly
  • Does the PR introduce any major changes worth communicating ? If yes, the "Release Note" label is set and a "Release Note" is specified in PR description.
  • Risk label is set correctly
  • The set of people pinged as reviewers is appropriate for the level of risk of the change

…ent unit.

Fixed a misidentified class (missed in change yesterday), calling a TextView a ConnectRegularTextView.
Fixed a typo in a variable name.
@coderabbitai
Copy link

coderabbitai bot commented Apr 2, 2025

📝 Walkthrough

Walkthrough

The pull request adds several new localized string resources for Portuguese, Swahili, Tigrinya, and the default English language to provide messages about remaining tasks or visits due by today or tomorrow and overall status updates. In addition, it refines the control flow of the onBindViewHolder method in the delivery progress adapter. The updated logic first checks the pending task count and, if greater than zero, uses a switch statement based on the value of remaining days to select the appropriate string resource that incorporates the pending count. If there are no pending tasks, a string indicating that all visits are done is used instead. Furthermore, a fragment is updated by changing the type of paymentAlertText from a specialized text view to a generic TextView and by renaming the tvJobDiscrepation variable to tvJobDescription.

Sequence Diagram(s)

sequenceDiagram
    participant VH as ViewHolder
    participant AD as Adapter
    participant RS as Resource Manager

    VH->>AD: onBindViewHolder(data: pending, remainingDays)
    AD->>AD: Check if pending > 0?
    alt Pending > 0
         AD->>AD: Switch on remainingDays value
         alt Case: remainingDays (0, 1, 2, >2)
              AD->>RS: Retrieve appropriate localized string (with pending value)
         end
    else Pending == 0
         AD->>RS: Retrieve "visits done" string resource
    end
    AD->>VH: Update tvRemaining with computed string
Loading

Suggested reviewers

  • Jignesh-dimagi
  • pm-dimagi
  • shubham1g5
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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

🧹 Nitpick comments (2)
app/res/values-pt/strings.xml (1)

510-513: New Portuguese Delivery Progress Strings Added

The new string resources for delivery progress—connect_results_summary_remaining_tomorrow, connect_results_summary_remaining_today, connect_results_summary_visits_done, and connect_results_summary_days_over—are clearly added. Please double-check that the translations (“%d até Amanhã”, “%d até Hoje”, “Todas as Visitas Realizadas”, “Dias Acima”) accurately capture the intended messaging and tone in Portuguese. Additionally, verify that the %d placeholder usage is consistent with how it’s formatted in other parts of the app.

app/res/values/strings.xml (1)

614-617: New English Delivery Progress Feedback Strings Added

The new (or updated) string resources for delivery progress in English—connect_results_summary_remaining_tomorrow, connect_results_summary_remaining_today, connect_results_summary_visits_done, and connect_results_summary_days_over—provide clear messaging for the delivery scenarios. Please ensure that the wording “%d by tomorrow”, “%d by today”, “All Visits Done”, and “Days Over” fully aligns with the design and tone guidelines, and that “Days Over” is the best choice to indicate that the delivery period has passed.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 98ea46c and 78dae96.

📒 Files selected for processing (6)
  • app/res/values-pt/strings.xml (1 hunks)
  • app/res/values-sw/strings.xml (1 hunks)
  • app/res/values-ti/strings.xml (1 hunks)
  • app/res/values/strings.xml (1 hunks)
  • app/src/org/commcare/adapters/ConnectDeliveryProgressReportAdapter.java (1 hunks)
  • app/src/org/commcare/fragments/connect/ConnectDeliveryProgressFragment.java (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
app/src/org/commcare/fragments/connect/ConnectDeliveryProgressFragment.java (1)
Learnt from: pm-dimagi
PR: dimagi/commcare-android#2847
File: app/src/org/commcare/android/database/connect/models/ConnectJobRecordV4.java:123-133
Timestamp: 2025-04-02T13:59:29.672Z
Learning: In ConnectJobRecord and related classes, paymentAccrued is guaranteed to be a small integer value that will not overflow and does not need decimal/floating point support.
🔇 Additional comments (5)
app/src/org/commcare/adapters/ConnectDeliveryProgressReportAdapter.java (1)

48-66: Improved text handling for delivery progress states

The new implementation enhances user experience by providing more specific messages based on time remaining and task status:

  • Shows "by today" when only 1 day remains
  • Shows "by tomorrow" when 2 days remain
  • Indicates "Days Over" when the delivery period has ended
  • Displays "All Visits Done" when all tasks are completed

This implementation aligns well with the PR objectives to provide better contextual information for users.

app/res/values-sw/strings.xml (1)

596-599: String resources properly added for Swahili localization

These new string resources provide appropriate Swahili translations for the time-sensitive delivery notifications:

  • "remaining_tomorrow" for tasks due tomorrow
  • "remaining_today" for tasks due today
  • "visits_done" for completed visits
  • "days_over" for expired delivery periods

The translations are consistent with the functionality described in the PR objectives.

app/res/values-ti/strings.xml (1)

494-497: LGTM! Added localized strings for delivery progress messages.

The new strings provide appropriate Tigrinya translations for the delivery progress indicators as described in the PR objectives:

  • "By tomorrow" indicator for delivery timing
  • "By today" for urgent deliveries
  • "All visits done" completion status
  • "Days over" for expired delivery periods

These additions enhance the user experience for Tigrinya-speaking users.

app/src/org/commcare/fragments/connect/ConnectDeliveryProgressFragment.java (2)

54-54: Good type simplification from ConnectRegularTextView to TextView.

Using the more generic TextView type instead of the specialized ConnectRegularTextView simplifies the code while maintaining functionality. This change reduces unnecessary coupling to custom view implementations.


203-203: Fixed variable naming from "discrepation" to "description".

The variable has been appropriately renamed from tvJobDiscrepation to tvJobDescription, which better reflects its purpose of displaying the job description. The corresponding usage in line 211 has also been updated correctly.

Also applies to: 211-211

<string name="connect_results_summary_all">ኩሎም</string>
<string name="connect_results_summary_remaining">ዝተረፈ</string>
<string name="connect_results_summary_remaining_days">%d ኣብ ውሽጢ %d መዓልቲ</string>
<string name="connect_results_summary_remaining_tomorrow">%d ብ ጽባሕ</string>
Copy link
Contributor

Choose a reason for hiding this comment

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

you leave me speechless!

ConnectBoldTextView hoursTitle = viewJobCard.findViewById(R.id.tvDailyVisitTitle);
ConnectBoldTextView tv_job_time = viewJobCard.findViewById(R.id.tv_job_time);
ConnectMediumTextView tvJobDiscrepation = viewJobCard.findViewById(R.id.tv_job_discrepation);
ConnectMediumTextView tvJobDescription = viewJobCard.findViewById(R.id.tv_job_discrepation);
Copy link
Contributor

Choose a reason for hiding this comment

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

seems like a typo in tv_job_discrepation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call, I found a few other similar typos when I searched so corrected them all in this commit: dec55c1

@OrangeAndGreen OrangeAndGreen merged commit bf55885 into connect_qa Apr 2, 2025
1 of 2 checks passed
@OrangeAndGreen OrangeAndGreen deleted the dv/delivery_progress_text_tweak branch April 2, 2025 18:32
@coderabbitai coderabbitai bot mentioned this pull request Apr 4, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants