Skip to content

Commit

Permalink
Shows only completed tips in tip list
Browse files Browse the repository at this point in the history
  • Loading branch information
NejcZdovc committed Apr 1, 2020
1 parent d12719b commit af96870
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,7 @@ void Contribution::OnExternalWalletServerPublisherInfo(
double amount,
const ledger::ExternalWallet& wallet,
const ledger::RewardsType type) {
if (!info || info->status != ledger::PublisherStatus::VERIFIED) {
if (!info) {
BLOG(ledger_, ledger::LogLevel::LOG_ERROR) << "Publisher not found";
ledger_->ContributionCompleted(
ledger::Result::LEDGER_ERROR,
Expand All @@ -1189,6 +1189,24 @@ void Contribution::OnExternalWalletServerPublisherInfo(
return;
}

if (info->status != ledger::PublisherStatus::VERIFIED) {
BLOG(ledger_, ledger::LogLevel::LOG_ERROR) << "Publisher not verified";

// we don't need callback as there is nothing to report back
SavePendingContribution(
info->publisher_key,
amount,
type,
[](const ledger::Result){});

ledger_->ContributionCompleted(
ledger::Result::LEDGER_ERROR,
amount,
contribution_id,
type);
return;
}

auto completed_callback = std::bind(&Contribution::ExternalWalletCompleted,
this,
_1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ void DatabaseContributionInfo::GetOneTimeTips(
"ON spi.publisher_key = pi.publisher_id "
"WHERE strftime('%%m', datetime(ci.created_at, 'unixepoch')) = ? AND "
"strftime('%%Y', datetime(ci.created_at, 'unixepoch')) = ? "
"AND ci.type = ?",
"AND ci.type = ? AND ci.step = ?",
kTableName,
kChildTableName);

Expand All @@ -586,6 +586,8 @@ void DatabaseContributionInfo::GetOneTimeTips(
BindString(command.get(), 1, std::to_string(year));
BindInt(command.get(), 2,
static_cast<int>(ledger::RewardsType::ONE_TIME_TIP));
BindInt(command.get(), 3,
static_cast<int>(ledger::ContributionStep::STEP_COMPLETED));

command->record_bindings = {
ledger::DBCommand::RecordBindingType::STRING_TYPE,
Expand Down

0 comments on commit af96870

Please sign in to comment.