Auto merge of #2015 - bitcartel:1780_sort_getoperationstatus, r=ebfull

Closes #1780. Result of z_getoperationstatus now sorted by operation's creation time.
This commit is contained in:
zkbot 2017-01-17 04:06:28 +00:00
commit 9cd91833a5
1 changed files with 7 additions and 0 deletions

View File

@ -3172,6 +3172,13 @@ Value z_getoperationstatus_IMPL(const Array& params, bool fRemoveFinishedOperati
}
}
// sort results chronologically by creation_time
std::sort(ret.begin(), ret.end(), [](Value a, Value b) -> bool {
const int64_t t1 = find_value(a.get_obj(), "creation_time").get_int64();
const int64_t t2 = find_value(b.get_obj(), "creation_time").get_int64();
return t1 < t2;
});
return ret;
}