Fix: Date was not shown if there were multiple best options
This commit is contained in:
parent
9b6d0822b2
commit
8ede03b604
2 changed files with 13 additions and 13 deletions
|
@ -1,4 +1,5 @@
|
|||
import Ember from 'ember';
|
||||
import moment from 'moment';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
classNames: ['evaluation-summary'],
|
||||
|
@ -72,9 +73,16 @@ export default Ember.Component.extend({
|
|||
|
||||
bestOptions.forEach((bestOption, i) => {
|
||||
if (this.get('poll.isFindADate')) {
|
||||
bestOptions[i].title = this.get('dates')[bestOption.key].title;
|
||||
const date = this.get(`dates.${bestOption.key}`);
|
||||
const format = date.hasTime ? 'LLLL' : moment.localeData()
|
||||
.longDateFormat('LLLL')
|
||||
.replace(
|
||||
moment.localeData().longDateFormat('LT'), '')
|
||||
.trim();
|
||||
bestOptions[i].title = date.title.format(format);
|
||||
} else {
|
||||
bestOptions[i].title = this.get('poll.options')[bestOption.key].title;
|
||||
const option = this.get(`poll.options.${bestOption.key}`);
|
||||
bestOptions[i].title = option.get('title');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -15,13 +15,9 @@
|
|||
|
||||
{{#if evaluationBestOptionsMultiple}}
|
||||
<ul>
|
||||
{{#each evaluationBestOptions as evaluationBestOption}}
|
||||
{{#each evaluationBestOptions as |evaluationBestOption|}}
|
||||
<li>
|
||||
{{#if poll.isFindADate}}
|
||||
<strong>{{formattedDate evaluationBestOption.title times=poll.isDateTime}}</strong>.
|
||||
{{else}}
|
||||
<strong>{{evaluationBestOption.title}}</strong>.
|
||||
{{/if}}
|
||||
<strong>{{evaluationBestOption.title}}</strong>.
|
||||
|
||||
<br/>
|
||||
|
||||
|
@ -50,11 +46,7 @@
|
|||
{{/each}}
|
||||
</ul>
|
||||
{{else}}
|
||||
{{#if poll.isFindADate}}
|
||||
<strong>{{formattedDate evaluationBestOptions.[0].title times=poll.isDateTime}}</strong>.
|
||||
{{else}}
|
||||
<strong>{{evaluationBestOptions.[0].title}}</strong>.
|
||||
{{/if}}
|
||||
<strong>{{evaluationBestOptions.[0].title}}</strong>.
|
||||
|
||||
{{#if poll.isFindADate}}
|
||||
{{#if evaluationBestOptions.[0].answers.yes}}
|
||||
|
|
Loading…
Reference in a new issue