Skip to content

[Due for payment 2025-11-19] [$250] Add more report fields for optimistic report names #68695

Description

@neil-marcellini

Problem

As described in the parent issue, we currently do not support optimistic report name computation for several formula parts referencing basic report fields. These parts are listed below.

{report:id} – Base62 report ID
{report:status} – Report status
{report:expensescount} – Number of expenses in report

Solution

Please add support for these report formula parts in the optimistic computation within App.

Here is the current back-end C++ implementation, which you will likely find useful for proposals.

report:id
    if (partName == "id") {
        return Report::formatIDAsBase62(reportID);
    }
string Report::formatIDAsBase62(int64_t id)
{
    string base62 = Num::asBase62String(id);
    string padding(11 - base62.size(), '0');
    return 'R' + padding + base62;
}

string Num::asBase62String(int64_t from)
{
    if (from < 0) {
        throw out_of_range("Negative values not supported");
    }

    string result = "00000000000";
    size_t ptr = 10;
    while (from) {
        result[ptr--] = base62alphabet[from % 62];
        from /= 62;
    }

    for (ptr = 0; ptr < 10; ptr++) {
        if (result[ptr] != '0') {
            break;
        }
    }

    return result.substr(ptr);
}

const char* Num::base62alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
report:status
    if (partName == "status") {
        const Report::statuses status = static_cast<Report::statuses>(reportJSON.getIntMemberWithDefault("status"));
        return Report::STATUSES[status];
    }

const char* Report::STATUSES[Report::STATUS_NUM_STATUSES] = {
    "Open",
    "Processing",
    "Archived",
    "Approved",
    "Reimbursed",
};
report:expensescount

I have created an internal issue to start returning this field to NewDot. We will return the transactions count field to Onyx and then App needs to optimistically update this field whenever a transaction is added, deleted, or moved away from a report.

    if (partName == "expensescount") {
        return to_string(reportJSON.getIntMemberWithDefault("transactionCount"));
    }

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021957525358844302093
  • Upwork Job ID: 1957525358844302093
  • Last Price Increase: 2025-09-11
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @strepanier03

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Fields

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