Hiding popunder if challenge data is incomplete (#10284)

* removing file that only contained a reference to a missing folder

* fixing typo

* using full dates to avoid moment warning in tests

* more typos

* sending an empty string to vue bootstrap tooltip (disabling it) if no challenge short name is set
This commit is contained in:
Brian Fenton
2018-04-28 10:38:38 -05:00
committed by Matteo Pagliazzi
parent 403ac1ab7e
commit c6c9503e22
7 changed files with 13 additions and 11 deletions

View File

@@ -1,3 +0,0 @@
This folder contains the test files for the new client side that is being developed.
The old client side tests can be found in /test/client-old.

View File

@@ -966,7 +966,7 @@ describe('shouldDo', () => {
m: false, m: false,
}; };
let today = moment('2017-01-27'); let today = moment('2017-01-27:00:00.000-00:00');
let week = today.monthWeek(); let week = today.monthWeek();
let dayOfWeek = today.day(); let dayOfWeek = today.day();
dailyTask.startDate = today.toDate(); dailyTask.startDate = today.toDate();
@@ -974,7 +974,7 @@ describe('shouldDo', () => {
dailyTask.repeat[DAY_MAPPING[dayOfWeek]] = true; dailyTask.repeat[DAY_MAPPING[dayOfWeek]] = true;
dailyTask.everyX = 1; dailyTask.everyX = 1;
dailyTask.frequency = 'monthly'; dailyTask.frequency = 'monthly';
day = moment('2017-02-24'); day = moment('2017-02-24:00:00.000-00:00');
expect(shouldDo(day, dailyTask, options)).to.equal(true); expect(shouldDo(day, dailyTask, options)).to.equal(true);
}); });

View File

@@ -12,7 +12,7 @@ if (process.env.LOAD_SERVER === '0') { // when the server is in a different proc
nconf.set('NODE_DB_URI', nconf.get('TEST_DB_URI')); nconf.set('NODE_DB_URI', nconf.get('TEST_DB_URI'));
nconf.set('NODE_ENV', 'test'); nconf.set('NODE_ENV', 'test');
nconf.set('IS_TEST', true); nconf.set('IS_TEST', true);
// We require src/server and npt src/index because // We require src/server and not src/index because
// 1. nconf is already setup // 1. nconf is already setup
// 2. we don't need clustering // 2. we don't need clustering
require('../../website/server/server'); // eslint-disable-line global-require require('../../website/server/server'); // eslint-disable-line global-require

View File

@@ -590,7 +590,7 @@ export default {
}, },
filterByTagList (taskList, tagList = []) { filterByTagList (taskList, tagList = []) {
let filteredTaskList = taskList; let filteredTaskList = taskList;
// fitler requested tasks by tags // filter requested tasks by tags
if (!isEmpty(tagList)) { if (!isEmpty(tagList)) {
filteredTaskList = taskList.filter( filteredTaskList = taskList.filter(
task => tagList.every(tag => task.tags.indexOf(tag) !== -1) task => tagList.every(tag => task.tags.indexOf(tag) !== -1)

View File

@@ -81,7 +81,7 @@
span.m-0(v-if="task.up && task.down")  |  span.m-0(v-if="task.up && task.down")  | 
span.m-0(v-if="task.down") -{{task.counterDown}} span.m-0(v-if="task.down") -{{task.counterDown}}
.d-flex.align-items-center(v-if="task.challenge && task.challenge.id") .d-flex.align-items-center(v-if="task.challenge && task.challenge.id")
.svg-icon.challenge(v-html="icons.challenge", v-if='!task.challenge.broken', v-b-tooltip.hover.bottom="`${task.challenge.shortName}`") .svg-icon.challenge(v-html="icons.challenge", v-if='!task.challenge.broken', v-b-tooltip.hover.bottom="shortName")
.svg-icon.challenge.broken(v-html="icons.brokenChallengeIcon", v-if='task.challenge.broken', @click='handleBrokenTask(task)', v-b-tooltip.hover.bottom="$t('brokenChaLink')") .svg-icon.challenge.broken(v-html="icons.brokenChallengeIcon", v-if='task.challenge.broken', @click='handleBrokenTask(task)', v-b-tooltip.hover.bottom="$t('brokenChaLink')")
.d-flex.align-items-center(v-if="hasTags", :id="`tags-icon-${task._id}`") .d-flex.align-items-center(v-if="hasTags", :id="`tags-icon-${task._id}`")
.svg-icon.tags(v-html="icons.tags") .svg-icon.tags(v-html="icons.tags")
@@ -627,6 +627,11 @@ export default {
hasTags () { hasTags () {
return this.task.tags && this.task.tags.length > 0; return this.task.tags && this.task.tags.length > 0;
}, },
shortName () {
if (this.task.challenge.broken) return '';
return this.task.challenge.shortName ? this.task.challenge.shortName.toString() : '';
},
}, },
methods: { methods: {
...mapActions({ ...mapActions({

View File

@@ -68,7 +68,7 @@ let api = {};
/** /**
* @apiDefine ChallengeSuccessExample * @apiDefine ChallengeSuccessExample
* @apiSuccessExample {json} Sucessfull response with single challenge * @apiSuccessExample {json} Successful response with single challenge
{ {
"data": { "data": {
"group": { "group": {
@@ -112,7 +112,7 @@ let api = {};
/** /**
* @apiDefine ChallengeArrayExample * @apiDefine ChallengeArrayExample
* @apiSuccessExample {json} Sucessful response with array of challenges * @apiSuccessExample {json} Successful response with array of challenges
{ {
"data": [{ "data": [{
"group": { "group": {

View File

@@ -125,7 +125,7 @@ export async function createTasks (req, res, options = {}) {
await owner.update(taskOrderUpdateQuery).exec(); await owner.update(taskOrderUpdateQuery).exec();
// tasks with aliases need to be validated asyncronously // tasks with aliases need to be validated asynchronously
await _validateTaskAlias(toSave, res); await _validateTaskAlias(toSave, res);
toSave = toSave.map(task => task.save({ // If all tasks are valid (this is why it's not in the previous .map()), save everything, withough running validation again toSave = toSave.map(task => task.save({ // If all tasks are valid (this is why it's not in the previous .map()), save everything, withough running validation again