start fixing commong

This commit is contained in:
Matteo Pagliazzi
2019-10-09 16:51:17 +02:00
parent 9cd43db401
commit 0c27fb24a5
76 changed files with 442 additions and 275 deletions

View File

@@ -45,13 +45,14 @@ export default function unlock (user, req = {}, analytics) {
each(setPaths, singlePath => {
if (get(user, `purchased.${singlePath}`) === true) {
alreadyOwnedItems++;
alreadyOwnedItems += 1;
}
});
if (alreadyOwnedItems === setPaths.length) {
throw new NotAuthorized(i18n.t('alreadyUnlocked', req.language));
// TODO write math formula to check if buying the full set is cheaper than the items individually
// TODO write math formula to check if buying
// the full set is cheaper than the items individually
// (item cost * number of remaining items) < setCost`
} /* else if (alreadyOwnedItems > 0) {
throw new NotAuthorized(i18n.t('alreadyUnlockedPart', req.language));