mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Fix various tests
This commit is contained in:
committed by
Sabe Jones
parent
3540a274b3
commit
fb56f7df20
@@ -4,12 +4,10 @@ import { // eslint-disable-line import/no-cycle
|
||||
model as Group,
|
||||
TAVERN_ID as tavernId,
|
||||
} from '../models/group';
|
||||
import { REPEATING_EVENTS } from '../../common/script/content/constants';
|
||||
import { getCurrentGalaEvent } from '../../common/script/content/constants/schedule';
|
||||
import common from '../../common';
|
||||
|
||||
export async function getWorldBoss () {
|
||||
const tavern = await Group
|
||||
.findById(tavernId)
|
||||
const tavern = await Group.findById(tavernId)
|
||||
.select('quest.progress quest.key quest.active quest.extra')
|
||||
.exec();
|
||||
if (tavern && tavern.quest && tavern.quest.active) {
|
||||
@@ -20,42 +18,46 @@ export async function getWorldBoss () {
|
||||
|
||||
export function getCurrentEvent () {
|
||||
const now = moment();
|
||||
const currEvtKey = Object.keys(REPEATING_EVENTS).find(evtKey => {
|
||||
const event = REPEATING_EVENTS[evtKey];
|
||||
const startDate = event.start.replace('1970', now.year());
|
||||
const endDate = event.end.replace('1970', now.year());
|
||||
const currEvtKey = Object.keys(common.content.repeatingEvents).find(
|
||||
evtKey => {
|
||||
const event = common.content.repeatingEventsS[evtKey];
|
||||
const startDate = event.start.replace('1970', now.year());
|
||||
const endDate = event.end.replace('1970', now.year());
|
||||
|
||||
return now.isBetween(startDate, endDate);
|
||||
});
|
||||
return now.isBetween(startDate, endDate);
|
||||
},
|
||||
);
|
||||
|
||||
if (!currEvtKey) {
|
||||
return getCurrentGalaEvent()
|
||||
return common.schedule.getCurrentGalaEvent();
|
||||
}
|
||||
return {
|
||||
event: currEvtKey,
|
||||
...REPEATING_EVENTS[currEvtKey],
|
||||
...common.content.repeatingEvents[currEvtKey],
|
||||
};
|
||||
}
|
||||
|
||||
export function getCurrentEventList () {
|
||||
const now = moment();
|
||||
const currentEventKeys = filter(Object.keys(REPEATING_EVENTS), eventKey => {
|
||||
const eventData = REPEATING_EVENTS[eventKey];
|
||||
const startDate = eventData.start.replace('1970', now.year());
|
||||
const endDate = eventData.end.replace('1970', now.year());
|
||||
const currentEventKeys = filter(
|
||||
Object.keys(common.content.repeatingEvents),
|
||||
eventKey => {
|
||||
const eventData = common.content.repeatingEvents[eventKey];
|
||||
const startDate = eventData.start.replace('1970', now.year());
|
||||
const endDate = eventData.end.replace('1970', now.year());
|
||||
|
||||
return now.isBetween(startDate, endDate);
|
||||
});
|
||||
return now.isBetween(startDate, endDate);
|
||||
},
|
||||
);
|
||||
|
||||
const currentEventList = [];
|
||||
|
||||
currentEventKeys.forEach(key => {
|
||||
currentEventList.push({
|
||||
event: key,
|
||||
...REPEATING_EVENTS[key],
|
||||
...common.content.repeatingEvents[key],
|
||||
});
|
||||
});
|
||||
|
||||
currentEventList.push(getCurrentGalaEvent());
|
||||
currentEventList.push(common.schedule.getCurrentGalaEvent());
|
||||
return currentEventList;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user