Skip to content
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

Updated readWriteTransaction to fix bug #317

Merged
merged 2 commits into from
Feb 23, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Moved 300000 to minimumAmountToTransfer constant
as per code review
  • Loading branch information
ryanmats authored Feb 22, 2017
commit ffb0694739157bd885e2101bc167cae6b4ea4f01
5 changes: 3 additions & 2 deletions spanner/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ function readWriteTransaction (instanceId, databaseId) {
// at a specific point in time
let transaction, firstBudget, secondBudget;
const transferAmount = 200000;
const minimumAmountToTransfer = 300000;

database.runTransaction()
.then((results) => {
Expand All @@ -126,8 +127,8 @@ function readWriteTransaction (instanceId, databaseId) {
console.log(`The second album's marketing budget: ${secondBudget}`);

// Makes sure the second album's budget is sufficient
if (secondBudget < 300000) {
throw new Error(`The second album's budget (${secondBudget}) is less than the minimum required amount of $300,000.`);
if (secondBudget < minimumAmountToTransfer) {
throw new Error(`The second album's budget (${secondBudget}) is less than the minimum required amount to transfer.`);
}
}),

Expand Down