More staging fixes (#9816)

* Added ability to adjust challenge task copy's streak

* Disabled stat allocation if method is incorrect
This commit is contained in:
Keith Holliday
2018-01-18 03:51:56 -07:00
committed by Matteo Pagliazzi
parent 6d57ce3050
commit c0276e3663
4 changed files with 20 additions and 3 deletions

View File

@@ -139,6 +139,23 @@ describe('PUT /tasks/:id', () => {
expect(savedHabit.up).to.eql(false);
expect(savedHabit.down).to.eql(false);
});
it('allows user to update their copy', async () => {
const userTasks = await user.get('/tasks/user');
const userChallengeTasks = userTasks.filter(task => task.challenge.id === challenge._id);
const userCopyOfChallengeTask = userChallengeTasks[0];
await user.put(`/tasks/${userCopyOfChallengeTask._id}`, {
notes: 'some new notes',
counterDown: 1,
counterUp: 2,
});
const savedHabit = await user.get(`/tasks/${userCopyOfChallengeTask._id}`);
expect(savedHabit.notes).to.eql('some new notes');
expect(savedHabit.counterDown).to.eql(1);
expect(savedHabit.counterUp).to.eql(2);
});
});
context('todos', () => {

View File

@@ -227,7 +227,7 @@
.svg-icon.info-icon(v-html="icons.information", v-b-tooltip.hover.righttop.html="$t('attributeAllocationHelp')")
.attributes
.custom-control.custom-radio.custom-control-inline(v-for="attr in ATTRIBUTES", :key="attr")
input.custom-control-input(:id="`attribute-${attr}`", type="radio", :value="attr", v-model="task.attribute")
input.custom-control-input(:id="`attribute-${attr}`", type="radio", :value="attr", v-model="task.attribute", :disabled="user.preferences.allocationMode !== 'taskbased'")
label.custom-control-label.attr-description(:for="`attribute-${attr}`", v-once, v-b-popover.hover="$t(`${attr}Text`)") {{ $t(attributesStrings[attr]) }}
.delete-task-btn.d-flex.justify-content-center.align-items-middle(@click="destroy()", v-if="purpose !== 'create' && !challengeAccessRequired")
.svg-icon.d-inline-b(v-html="icons.destroy")

View File

@@ -44,7 +44,7 @@
"hard": "Hard",
"attributes": "Stats",
"attributeAllocation": "Stat Allocation",
"attributeAllocationHelp": "Stat allocation is an option that provides methods for Habitica to automatically assign an earned Stat Point to a Stat immediately upon level-up. <br/><br/> You can adjust how Automatic Allocation is handled from the Stats section of your profile.",
"attributeAllocationHelp": "Stat allocation is an option that provides methods for Habitica to automatically assign an earned Stat Point to a Stat immediately upon level-up. <br/><br/> You can set your Automatic Allocation method to Task Based in the Stats section of your profile.",
"progress": "Progress",
"daily": "Daily",
"dailies": "Dailies",

View File

@@ -144,7 +144,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', 'yesterDaily']);
return _.pick(initialSanitization, ['streak', 'checklist', 'attribute', 'reminders', 'tags', 'notes', 'collapseChecklist', 'alias', 'yesterDaily', 'counterDown', 'counterUp']);
};
// Sanitize checklist objects (disallowing id)