Skip to content

Styling for Expired Opportunities Card#3572

Merged
shubham1g5 merged 6 commits intomasterfrom
CCCT-2139-style-expired-job
Feb 27, 2026
Merged

Styling for Expired Opportunities Card#3572
shubham1g5 merged 6 commits intomasterfrom
CCCT-2139-style-expired-job

Conversation

@jaypanchal-13
Copy link
Contributor

@jaypanchal-13 jaypanchal-13 commented Feb 26, 2026

Product Description

Ticket -> https://dimagi.atlassian.net/browse/CCCT-2139

Technical Summary

  • Handled else case for job expiry date within 5 days as it was creating issue(red text was seen for other job's)
  • Styling change for expired/completed job's

Screen shot ->

image

Feature Flag

Safety Assurance

Safety story

Automated test coverage

QA Plan

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

cross-request: dimagi/commcare-core#1521

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 26, 2026

📝 Walkthrough

Walkthrough

This change replaces the string key connect_expired_on with connect_task_ended_on across all localization files (Spanish, French, Hindi, Lithuanian, Norwegian, Portuguese, Swahili, Tigrinya, and English) and updates related UI components to reflect a semantic shift from "expired on" to "task ended on" terminology. A new color resource moon_gray is introduced and applied to date text styling for non-expiring items. The adapter and detail sheet fragment components are updated to use the new string key and apply the new color. Additionally, the expiry date calculation method is refactored to use Calendar-based date normalization for improved accuracy.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The PR description provides a ticket link and technical summary, but lacks critical details in Safety Assurance and QA Plan sections that are required by the template. Complete the Safety Assurance section with testing details and QA Plan with regression testing confirmation. Provide concrete details on automated test coverage and QA validation steps.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title describes styling changes for expired/completed jobs, which directly matches the main code changes replacing 'connect_expired_on' with 'connect_task_ended_on' and adding visual styling adjustments.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch CCCT-2139-style-expired-job

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/src/org/commcare/adapters/JobListConnectHomeAppsAdapter.java`:
- Around line 182-184: The code in JobListConnectHomeAppsAdapter currently sets
dateRes to R.string.connect_task_ended_on when deliveryComplete() is true;
change the branching so that if deliveryComplete() returns true you set dateRes
to the "Delivery complete" string resource (use the app's existing resource for
the delivery-complete message, e.g. R.string.connect_delivery_complete) instead
of the ended/expired label, ensuring dateRes is used unchanged elsewhere; update
the ternary/if that computes dateRes in the method where deliveryComplete() is
checked.

In `@app/src/org/commcare/connect/database/ConnectJobUtils.java`:
- Around line 417-435: The current isExpiryDateUnderFiveDays(Date expiryDate)
uses millisecond arithmetic which miscounts days across DST shifts; replace the
millis-based diff with a date-based difference using java.time: convert
expiryDate and the current time to LocalDate via Instant/ZoneId.systemDefault(),
compute daysBetween with ChronoUnit.DAYS.between(LocalDate.now(zone),
expiryLocalDate) (or between(expiryLocalDate, todayLocalDate) with sign
adjusted), and return true when the resulting long is between 0 and 5 inclusive;
update the logic in ConnectJobUtils.isExpiryDateUnderFiveDays to use Instant,
LocalDate, ZoneId, and ChronoUnit instead of TimeUnit.MILLISECONDS.toDays.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 519effc and fcd23e4.

📒 Files selected for processing (13)
  • app/res/values-es/strings.xml
  • app/res/values-fr/strings.xml
  • app/res/values-hi/strings.xml
  • app/res/values-lt/strings.xml
  • app/res/values-no/strings.xml
  • app/res/values-pt/strings.xml
  • app/res/values-sw/strings.xml
  • app/res/values-ti/strings.xml
  • app/res/values/colors.xml
  • app/res/values/strings.xml
  • app/src/org/commcare/adapters/JobListConnectHomeAppsAdapter.java
  • app/src/org/commcare/connect/database/ConnectJobUtils.java
  • app/src/org/commcare/fragments/connect/ConnectJobDetailBottomSheetDialogFragment.java

Comment on lines 182 to 184
int dateRes = deliveryComplete
? R.string.connect_expired_on
? R.string.connect_task_ended_on
: R.string.connect_complete_by;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Use “Delivery complete” messaging for deliveryComplete() jobs.

This branch still maps completed deliveries to a date-ended label. For completed delivery states, the UI should show the achievement-oriented “Delivery complete” message rather than an ended/expired date label.

Based on learnings: In the Connect feature, when showing job completion status in JobListConnectHomeAppsAdapter, prioritize showing "Delivery complete" message over "Expired on [date]" when deliveryComplete() is true, to acknowledge user achievement even if the deadline has also passed.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/src/org/commcare/adapters/JobListConnectHomeAppsAdapter.java` around
lines 182 - 184, The code in JobListConnectHomeAppsAdapter currently sets
dateRes to R.string.connect_task_ended_on when deliveryComplete() is true;
change the branching so that if deliveryComplete() returns true you set dateRes
to the "Delivery complete" string resource (use the app's existing resource for
the delivery-complete message, e.g. R.string.connect_delivery_complete) instead
of the ended/expired label, ensuring dateRes is used unchanged elsewhere; update
the ternary/if that computes dateRes in the method where deliveryComplete() is
checked.

<color name="violet_blue">#3C42BF</color>
<color name="pale_violet_blue">#C8CAEF</color>
<color name="light_indigo">#757BD8</color>
<color name="moon_gray">#909090</color>
Copy link
Contributor

Choose a reason for hiding this comment

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

Cool color name!

@shubham1g5
Copy link
Contributor

@damagatchi retest this please

@shubham1g5 shubham1g5 merged commit a0d0aae into master Feb 27, 2026
10 checks passed
@shubham1g5 shubham1g5 deleted the CCCT-2139-style-expired-job branch February 27, 2026 14:05
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.

4 participants