-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new command "export_transfers" to save transfers to csv #4236
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good at first glance, see #4153 though.
src/simplewallet/simplewallet.cpp
Outdated
message_writer() << (boost::format("%8.8s %6.6s %25.25s %20.20s %s %s %d %s %s%s") % "pool" % "in" % get_human_readable_timestamp(pd.m_timestamp) % print_money(pd.m_amount) % string_tools::pod_to_hex(pd.m_tx_hash) % payment_id % pd.m_subaddr_index.minor % "-" % note % double_spend_note).str(); | ||
|
||
transfers.push_back({ | ||
tr("pool"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure writing translated data to a formatted file is a good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be ok now.
I have used tr()
only in show_transfers
but not in export_transfers
src/simplewallet/simplewallet.cpp
Outdated
pd.m_tx_hash, | ||
payment_id, | ||
0, | ||
{{"-", pd.m_amount}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not do the same as in the "in" case?
std::string destination = m_wallet->get_subaddress_as_str({m_current_subaddress_account, pd.m_subaddr_index.minor});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Thanks guys for the review. |
It is merged now. |
ping :) |
If you want it in 0.13, now would be a good time to be just in time. |
Hi @moneromooo-monero, thanks for reminding me about this PR. |
OK, I'll ping from time to time then. |
ping :) |
c2e8938
to
a935714
Compare
Pong :) Rebased on master, and all reviews addressed! |
src/simplewallet/simplewallet.cpp
Outdated
@@ -7034,7 +7034,7 @@ bool simple_wallet::show_transfers(const std::vector<std::string> &args_) | |||
|
|||
message_writer(color, false) << formatter | |||
% transfer.block | |||
% transfer.direction | |||
% tr(transfer.direction.c_str()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You use tr on literals, since a tool gathers the literal to put it in a file. So tr should be moved to whatever code assigns transfer.direction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh ok, didn't know.
If I move the tr to whatever assigns transfer.direction, then the csv will also be using the translated string. Should I just not use tr at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good point. Hmm. I suppose if they both have to have the same strings, translated is probably best...
You can simply drop the last two commits. |
4e7a9e0
to
a935714
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed
a935714 Add new command "export_transfers" to save transfers to csv (sachaaaaa)
This pull request adds a new
export_transfers
command to the wallet cli that exports the transfers to a csv file.Since
show_transfers
andexport_transfers
basically require the same data, I've added a new functionget_transfers
that returns a vector oftransfer_view
structs (new structure as well). That function does all the querying, calculations, sorting and can consume some of the common arguments.Then, it's up to the caller function to display the data in the appropriate way (print or export as csv).
Notable difference between the csv file and the printed list of transfers:
Changes made to both: