Skip to content

Commit

Permalink
Compatibility with v3 pricelist
Browse files Browse the repository at this point in the history
ZeusJunior committed Feb 23, 2020

Verified

This commit was signed with the committer’s verified signature.
cho-m Michael Cho
1 parent 1167901 commit 099aa5c
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 0 additions & 5 deletions app/pricelist.js
Original file line number Diff line number Diff line change
@@ -39,11 +39,6 @@ pricelist.addItems = async function(search, options) {
}
}

/**
* Keeping it split into two then's
* for better readability for now.
* ^ You can not do this if you're not taking scope into account
*/
const generatedSkus = search.map((item) => getSKU(item));
skus = skus.concat(generatedSkus);

8 changes: 8 additions & 0 deletions utils/renderPricelist.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require('fs-extra');
const paths = require('../resources/paths');
const getName = require('./getName');
/**
* Renders the pricelist page with info
* @property {Object} res - The res from expressjs
@@ -11,6 +12,13 @@ const paths = require('../resources/paths');
module.exports = function({ res, type, message, failedItems = [] }) {
return fs.readJSON(paths.files.pricelist)
.then((pricelist) => {
for (i = 0; i < pricelist.length; i++) {
const item = pricelist[i];
if (!item.name) {
item.name = getName(item.sku);
}
}

res.render('index', {
type,
failedItems,

0 comments on commit 099aa5c

Please sign in to comment.