Skip to content

Commit

Permalink
add nested complexity
Browse files Browse the repository at this point in the history
Change-Id: I9eda989f7f0f13210bc66932a50455345c02eb7a
  • Loading branch information
knorrest committed Jan 5, 2023
1 parent 801b0c0 commit 149c692
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/js-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,23 @@ function extractEvents(
}
}


function mark_purchased(transaction) {
transaction.state = TransactionState.PURCHASED
for (item in transaction.items) {
if (item.mtb_product_ids) {
if (item.mtb_product_ids) {
for (mp_id in item.mtb_product_ids) {
try {
mtb_prod = get_db_mtb_product(None, mp_id, all=True, refresh=False)
mtb_prod.purchased = True
mtb_prod.save()
}
catch(exc) {
logger.error("Failed to mark mtb_product {mp_id} as purchase", exc_info=exc)
}
}
}
}
}
}

0 comments on commit 149c692

Please sign in to comment.