mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-17 08:32:13 +11:00
🐛 fixed logging broken
This commit is contained in:
parent
4689fe7077
commit
8f3f2f0b32
2 changed files with 12 additions and 9 deletions
|
|
@ -107,6 +107,7 @@ public:
|
||||||
{
|
{
|
||||||
Transaction temp(a_name, b_name, amount);
|
Transaction temp(a_name, b_name, amount);
|
||||||
Transaction temp2 = temp;
|
Transaction temp2 = temp;
|
||||||
|
std::cout << temp.from << ' ' << temp.to << '\n';
|
||||||
users.modify_if(a_name, [&temp](User &a) {
|
users.modify_if(a_name, [&temp](User &a) {
|
||||||
a.log.AddTrans(std::move(temp));
|
a.log.AddTrans(std::move(temp));
|
||||||
});
|
});
|
||||||
|
|
@ -176,12 +177,8 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint32_t i = 0; i < u.log.data.size(); ++i)
|
for (uint32_t i = 0; i < u.log.data.size() && u.log.data[i].amount; ++i)
|
||||||
{
|
{
|
||||||
if (!u.log.data[i].amount)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
res[i]["to"] = u.log.data[i].to;
|
res[i]["to"] = u.log.data[i].to;
|
||||||
res[i]["from"] = u.log.data[i].from;
|
res[i]["from"] = u.log.data[i].from;
|
||||||
res[i]["amount"] = u.log.data[i].amount;
|
res[i]["amount"] = u.log.data[i].amount;
|
||||||
|
|
|
||||||
|
|
@ -6,21 +6,27 @@
|
||||||
struct Log
|
struct Log
|
||||||
{
|
{
|
||||||
std::vector<Transaction> data;
|
std::vector<Transaction> data;
|
||||||
|
uint32_t end = 0;
|
||||||
void AddTrans(Transaction &&v)
|
void AddTrans(Transaction &&v)
|
||||||
{
|
{
|
||||||
if (!data.size())
|
if (!data.size())
|
||||||
{
|
{
|
||||||
data.resize(50);
|
data.resize(50);
|
||||||
}
|
}
|
||||||
for (size_t i = 1; i < data.size(); ++i)
|
if (end)
|
||||||
{
|
{
|
||||||
if (!data[i].amount)
|
for (uint32_t i = end; i > 0; --i)
|
||||||
{
|
{
|
||||||
|
std::cout << i << '\n';
|
||||||
data[i] = std::move(data[i - 1]);
|
data[i] = std::move(data[i - 1]);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
data[i] = std::move(data[i - 1]);
|
|
||||||
}
|
}
|
||||||
data[0] = std::move(v);
|
data[0] = std::move(v);
|
||||||
|
if (end < 50)
|
||||||
|
{
|
||||||
|
++end;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//[*][*][]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue