fix(fix): hide future mystery sets in Time Travel shop

...not in the gear tree
This commit is contained in:
Sabe Jones 2021-04-02 15:50:20 -05:00
parent cdb058b696
commit b3e3d0cb63
2 changed files with 7 additions and 2 deletions

View file

@ -29,7 +29,7 @@ const FIRST_MYSTERY_SET = moment('2014-02-01');
for (
let mysteryMonth = FIRST_MYSTERY_SET;
moment(mysteryMonth).startOf('month').isSameOrBefore(moment());
moment(mysteryMonth).startOf('month').isSameOrBefore(moment().add(1, 'months'));
mysteryMonth = moment(mysteryMonth).add(1, 'months')
) {
const setKey = moment(mysteryMonth).format('YYYYMM');

View file

@ -3,6 +3,7 @@ import filter from 'lodash/filter';
import keys from 'lodash/keys';
import union from 'lodash/union';
import reduce from 'lodash/reduce';
import moment from 'moment';
import mysterySets from './mystery-sets';
import gear from './gear';
@ -24,7 +25,11 @@ const timeTravelerStore = user => {
ownedKeys = keys(typeof owned.toObject === 'function' ? owned.toObject() : owned);
ownedKeys = union(ownedKeys, unopenedGifts);
return reduce(mystery, (m, v, k) => {
if (k === 'wondercon' || ownedKeys.indexOf(v.items[0].key) !== -1) {
if (
k === 'wondercon'
|| ownedKeys.indexOf(v.items[0].key) !== -1
|| (moment(k).isAfter() && moment(k).isBefore('3000-01-01'))
) {
return m;
}
m[k] = v;