use cached urgency() for json exports (#3867)

This commit is contained in:
Felix Stupp 2025-05-05 16:10:02 +02:00 committed by GitHub
parent 416c6d3ca4
commit 499f931f67
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 5 additions and 5 deletions

View file

@ -275,7 +275,7 @@ void Hooks::onAdd(Task& task) const {
// - all emitted non-JSON lines are considered feedback or error messages
// depending on the status code.
//
void Hooks::onModify(const Task& before, Task& after) const {
void Hooks::onModify(Task& before, Task& after) const {
if (!_enabled) return;
Timer timer;

View file

@ -40,7 +40,7 @@ class Hooks {
void onLaunch() const;
void onExit() const;
void onAdd(Task&) const;
void onModify(const Task&, Task&) const;
void onModify(Task&, Task&) const;
std::vector<std::string> list() const;
private:

View file

@ -777,7 +777,7 @@ void Task::parseLegacy(const std::string& line) {
}
////////////////////////////////////////////////////////////////////////////////
std::string Task::composeJSON(bool decorate /*= false*/) const {
std::string Task::composeJSON(bool decorate /*= false*/) {
std::stringstream out;
out << '{';
@ -894,7 +894,7 @@ std::string Task::composeJSON(bool decorate /*= false*/) const {
#ifdef PRODUCT_TASKWARRIOR
// Include urgency.
if (decorate) out << ',' << "\"urgency\":" << urgency_c();
if (decorate) out << ',' << "\"urgency\":" << urgency();
#endif
out << '}';

View file

@ -68,7 +68,7 @@ class Task {
Task(rust::Box<tc::TaskData>);
void parse(const std::string&);
std::string composeJSON(bool decorate = false) const;
std::string composeJSON(bool decorate = false);
// Status values.
enum status { pending, completed, deleted, recurring, waiting };