mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-13 15:38:59 +00:00
Added yesterdailiy to model
This commit is contained in:
parent
60de7c8f21
commit
5d0fe0aac3
5 changed files with 7 additions and 2 deletions
|
|
@ -133,6 +133,7 @@ describe('POST /tasks/user', () => {
|
|||
expect(task.completed).to.equal(false);
|
||||
expect(task.streak).not.to.equal('never');
|
||||
expect(task.value).not.to.equal(324);
|
||||
expect(task.yesterDaily).to.equal(true);
|
||||
});
|
||||
|
||||
it('ignores invalid fields', async () => {
|
||||
|
|
|
|||
|
|
@ -396,6 +396,7 @@ describe('PUT /tasks/:id', () => {
|
|||
notes: 'some new notes',
|
||||
frequency: 'daily',
|
||||
everyX: 5,
|
||||
yesterDaily: false,
|
||||
startDate: moment().add(1, 'days').toDate(),
|
||||
});
|
||||
|
||||
|
|
@ -405,6 +406,7 @@ describe('PUT /tasks/:id', () => {
|
|||
expect(savedDaily.everyX).to.eql(5);
|
||||
expect(savedDaily.isDue).to.be.false;
|
||||
expect(savedDaily.nextDue.length).to.eql(6);
|
||||
expect(savedDaily.yesterDaily).to.be.false;
|
||||
});
|
||||
|
||||
it('can update checklists (replace it)', async () => {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ module.exports = function taskDefaults (task = {}) {
|
|||
challenge: {
|
||||
shortName: 'None',
|
||||
},
|
||||
yesterDaily: true,
|
||||
reminders: [],
|
||||
attribute: 'str',
|
||||
createdAt: new Date(), // TODO these are going to be overwritten by the server...
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { authWithHeaders } from '../../middlewares/auth';
|
||||
import cron from '../middlewares/cron';
|
||||
import cron from '../../middlewares/cron';
|
||||
|
||||
let api = {};
|
||||
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ TaskSchema.statics.findByIdOrAlias = async function findByIdOrAlias (identifier,
|
|||
TaskSchema.statics.sanitizeUserChallengeTask = function sanitizeUserChallengeTask (taskObj) {
|
||||
let initialSanitization = this.sanitize(taskObj);
|
||||
|
||||
return _.pick(initialSanitization, ['streak', 'checklist', 'attribute', 'reminders', 'tags', 'notes', 'collapseChecklist', 'alias']);
|
||||
return _.pick(initialSanitization, ['streak', 'checklist', 'attribute', 'reminders', 'tags', 'notes', 'collapseChecklist', 'alias', 'yesterDaily']);
|
||||
};
|
||||
|
||||
// Sanitize checklist objects (disallowing id)
|
||||
|
|
@ -244,6 +244,7 @@ export let DailySchema = new Schema(_.defaults({
|
|||
weeksOfMonth: {type: [Number], default: []}, // Weeks of the month that the daily should repeat on
|
||||
isDue: {type: Boolean},
|
||||
nextDue: [{type: String}],
|
||||
yesterDaily: {type: Boolean, default: true},
|
||||
}, habitDailySchema(), dailyTodoSchema()), subDiscriminatorOptions);
|
||||
export let daily = Task.discriminator('daily', DailySchema);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue