Skip to content

Commit

Permalink
Prepare code for NFT Update Formula Support
Browse files Browse the repository at this point in the history
  • Loading branch information
dogracer committed Jan 23, 2023
1 parent 0799ed1 commit ef2ee78
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/gas/cell-edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
*/
import { sheetContainsCoinData, sheetContainsNFTData } from './sheet';
import { setFMVStrategyOnRow } from './fmv';
import { setFMVStrategyOnRow } from './formulas-coin';
import { CompleteDataRow } from '../types';
import getLastRowWithDataPresent from '../last-row';

Expand Down
2 changes: 1 addition & 1 deletion src/gas/examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import resetTotalSheet from './totals';
import { newCategorySheet } from './categories';
import { formatSheet } from './format';
import { newCoinSheet } from './new-coin';
import { updateFMVFormulas } from './fmv';
import { updateFMVFormulas } from './formulas-coin';

/**
* Creates example coins with data showing how HODL Totals works
Expand Down
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions src/gas/formulas-nft.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* @NotOnlyCurrentDoc Limits the script to only accessing the current sheet.
*
*/

/* global GoogleAppsScript */
/* global Browser */

/**
* xxxxx
*
* @return the newly created sheet, for function chaining purposes.
*/
export function updateNFTFormulas(sheet: GoogleAppsScript.Spreadsheet.Sheet | null): GoogleAppsScript.Spreadsheet.Sheet | null {
if ((sheet !== null) && (typeof ScriptApp !== 'undefined')) {
Browser.msgBox('NFT Update Formulas', 'TODO', Browser.Buttons.OK);
}
return null;
}
6 changes: 3 additions & 3 deletions src/gas/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import resetTotalSheet from './totals';
import { newCoinSheet } from './new-coin';
import { newNFTSheet } from './new-nft';
import { formatSheet } from './format';
import { updateFMVFormulas } from './fmv';
import { updateFMVFormulas } from './formulas-coin';
import { updateNFTFormulas } from './formulas-nft';
import { calculateCoinGainLoss, calculateNFTGainLossStatus } from './calculate';
import { formatNFTSheet } from './format-nft';
import { sheetContainsNFTData, sheetContainsCoinData } from './sheet';
Expand Down Expand Up @@ -148,8 +149,7 @@ function updateFormulas_(): GoogleAppsScript.Spreadsheet.Sheet | null {
if (sheetContainsCoinData(sheet)) {
updateFMVFormulas(sheet);
} else if (sheetContainsNFTData(sheet)) {
Browser.msgBox('NFT Update Formulas', 'TODO', Browser.Buttons.OK);
// updateNFTFormulas(sheet);
updateNFTFormulas(sheet);
} else {
Browser.msgBox('Active Sheet Does Not Support Updating Formulas', `The active sheet "${sheet.getName()}" does not look like a tracking sheet with Formulas that can be updated using this command. HODL Totals can only only update formulas on tracking sheets originally created using HODL Totals commands.`, Browser.Buttons.OK);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/fmv.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { UnitTestWrapper, assert, assertCell, createTempSheet, fillInTempSheet, deleteTempSheet } from './utils.test';
import { DataValidationRow, CompleteDataRow } from '../src/types';
import { setFMVformulasOnSheet } from '../src/gas/fmv';
import { setFMVformulasOnSheet } from '../src/gas/formulas-coin';
import validate from '../src/validate';
import getLastRowWithDataPresent from '../src/last-row';

Expand Down

0 comments on commit ef2ee78

Please sign in to comment.