Skip to content

[HOLD 67823][$250] [ORTF] - report:created and report:startdate not optimistically computed #68803

@lanitochka17

Description

@lanitochka17

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.1.97-1
Reproducible in staging?: Y
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from TestRail: #65862
Email or phone of affected tester (no customers): applausetester+ag1908.2@applause.expensifail.com
Issue reported by: Applause - Internal Team

Set up

  1. Follow the pre-testing steps in the manual test document

Action Performed:

  1. Log into new expensify

  2. Go to workspace settings > Reports

  3. Click Default report title

  4. Edit the Default report title field with:
    Created {report:created} vs Started {report:startdate}

  5. Save the new title

  6. Create a new report via FAB

  7. Add an expense with a date before the report was created

Expected Result:

After steps 6 and 7 the report name should be computed properly

Actual Result:

After step 6 the report name is set to the un-computed formula until the backend responds. After step 7, the name remains unchanged until the backend responds

Workaround:

Unknown

Platforms:

All

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop
Platforms Tested: On which of our officially supported platforms was this issue tested:
  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
2025-09-12_08-27-39.mp4
2025-09-12_08-30-46.mp4
Backend implementation
    if (partName == "created" || partName == "createddate" || partName == "createdate") {
        return Formula::getFormattedDateForPart(db, fieldPath, reportJSON.getStringMemberWithDefault("created", ""), "yyyy-MM-dd HH:mm:ss");
    }
    if (partName == "startdate" || partName == "enddate") {
        const string date = Report::getTransactionCreatedDate(db, reportID, partName == "enddate");
        return Formula::getFormattedDateForPart(db, fieldPath, date);
    }
string Report::getTransactionCreatedDate(SQLite& db, const int64_t reportID, const bool forMostRecentTransaction, const string& defaultDate)
{
    // Get the most or least recent created date from the report transactions, excluding partial transactions
    const string transactionCreated = DB::read(db,
        "SELECT COALESCE(modifiedCreated, created) AS transactionCreated "
        "FROM transactions "
        "WHERE reportID > 0 "
        "  AND reportID = " + SQ(reportID) + " "
        "  AND (COALESCE(modifiedAmount, amount) != " + to_string(Transaction::PARTIAL_AMOUNT) + " OR COALESCE(NULLIF(modifiedMerchant, ''), merchant) != " + SQ(Transaction::PARTIAL_MERCHANT) + ") "
        "ORDER BY transactionCreated " + (forMostRecentTransaction ? "DESC" : "ASC") + " "
        "LIMIT 1;"
    );
    return transactionCreated.empty() ? defaultDate : transactionCreated;
}
    /**
     * Get the created date of the most recent transaction on a report, otherwise the created date of the oldest transaction.
     * If the report has no transactions, return the default date.
     */
    static string getTransactionCreatedDate(SQLite& db, const int64_t reportID, const bool forMostRecentTransaction, const string& defaultDate = SComposeTime("%Y-%m-%d", STimeNow()));
    static constexpr auto PARTIAL_AMOUNT = 0;
    static constexpr auto PARTIAL_MERCHANT = "(none)";

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021966528082461829129
  • Upwork Job ID: 1966528082461829129
  • Last Price Increase: 2025-09-19
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @neil-marcellini

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributorsWeeklyKSv2

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions