mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-13 04:37:36 +01:00
remove old console.logs
This commit is contained in:
@@ -289,7 +289,6 @@ export default {
|
||||
},
|
||||
},
|
||||
|
||||
/* eslint-disable no-console */
|
||||
mounted () {
|
||||
Promise.all([
|
||||
this.$store.dispatch('user:fetch'),
|
||||
@@ -311,7 +310,6 @@ export default {
|
||||
this.goto('intro', 0);
|
||||
}, 2000);
|
||||
|
||||
console.log('before first yesterDailies run, current time:', (new Date()).toString());
|
||||
this.runYesterDailies();
|
||||
|
||||
// Do not remove the event listener as it's live for the entire app lifetime
|
||||
@@ -334,45 +332,30 @@ export default {
|
||||
}
|
||||
}, 1000),
|
||||
scheduleNextCron () {
|
||||
console.log('scheduling next cron (scheduleNextCron fn), current time:', (new Date()).toString());
|
||||
// Open yesterdailies modal the next time cron runs
|
||||
const dayStart = this.user.preferences.dayStart;
|
||||
let nextCron = moment().hours(dayStart).minutes(0).seconds(0).milliseconds(0);
|
||||
|
||||
console.log(
|
||||
'scheduling next cron, current time:', (new Date()).toString(),
|
||||
'dayStart', dayStart,
|
||||
'nextCron (base)', (new Date(nextCron.toDate())).toString());
|
||||
|
||||
const currentHour = moment().format('H');
|
||||
if (currentHour >= dayStart) {
|
||||
nextCron = nextCron.add(1, 'day');
|
||||
}
|
||||
|
||||
console.log('next cron after edit', nextCron.toDate());
|
||||
|
||||
// Setup a listener that executes 10 seconds after the next cron time
|
||||
this.nextCron = Number(nextCron.format('x'));
|
||||
this.isRunningYesterdailies = false;
|
||||
|
||||
console.log('finished running yesterDailies');
|
||||
},
|
||||
async runYesterDailies () {
|
||||
console.log('isRunningYesterdailies:', this.isRunningYesterdailies, (new Date()).toString());
|
||||
// @TODO: Hopefully we don't need this even we load correctly
|
||||
if (this.isRunningYesterdailies) return;
|
||||
console.log('running yesterdailies at, current time:', new Date(), 'needsCron:', this.user.needsCron);
|
||||
this.isRunningYesterdailies = true;
|
||||
|
||||
if (!this.user.needsCron) {
|
||||
console.log('cron not needed, scheduling, current time:', (new Date()).toString());
|
||||
this.handleUserNotifications(this.user.notifications);
|
||||
this.scheduleNextCron();
|
||||
return;
|
||||
}
|
||||
|
||||
let dailys = this.$store.state.tasks.data.dailys;
|
||||
console.log('running yesterdailies (real part), current time:', (new Date()).toString());
|
||||
|
||||
let yesterDay = moment().subtract('1', 'day').startOf('day').add({
|
||||
hours: this.user.preferences.dayStart,
|
||||
@@ -385,40 +368,29 @@ export default {
|
||||
if (task.yesterDaily && due) this.yesterDailies.push(task);
|
||||
});
|
||||
|
||||
console.log('yesterDailies to do', this.yesterDailies.length);
|
||||
|
||||
if (this.yesterDailies.length === 0) {
|
||||
console.log('no yesterDailies, scheduling cron, current time:', (new Date()).toString());
|
||||
this.runYesterDailiesAction();
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('showing yesterDailies modal, current time:', (new Date()).toString());
|
||||
|
||||
this.$root.$emit('show::modal', 'yesterdaily');
|
||||
},
|
||||
async runYesterDailiesAction () {
|
||||
console.log('yesterDailies action, current time:', (new Date()).toString());
|
||||
// Run Cron
|
||||
await axios.post('/api/v3/cron');
|
||||
console.log('after /cron call, current time:', (new Date()).toString());
|
||||
|
||||
// Notifications
|
||||
|
||||
// Sync
|
||||
// @TODO add a loading spinner somewhere
|
||||
console.log('syncing user after cron, current time:', (new Date()).toString());
|
||||
await Promise.all([
|
||||
this.$store.dispatch('user:fetch', {forceLoad: true}),
|
||||
this.$store.dispatch('tasks:fetchUserTasks', {forceLoad: true}),
|
||||
]);
|
||||
console.log('synced user after cron, current time:', (new Date()).toString());
|
||||
|
||||
this.handleUserNotifications(this.user.notifications);
|
||||
console.log('scheduling next cron after runYesterDailiesAction, current time:', (new Date()).toString());
|
||||
this.scheduleNextCron();
|
||||
},
|
||||
/* eslint-enable no-console */
|
||||
|
||||
transferGroupNotification (notification) {
|
||||
if (!this.user.groupNotifications) this.user.groupNotifications = [];
|
||||
|
||||
Reference in New Issue
Block a user