Skip to content

Commit

Permalink
Merge branch 'master' into feature/show-familycamp-details
Browse files Browse the repository at this point in the history
  • Loading branch information
googol authored Jul 20, 2016
2 parents 272ccd2 + bc6c3c2 commit decf8c1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion conf/payment-date-mappings.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
"su 31.7.": ["2016-07-31"],

"Osallistun koko leirin ajaksi": ["2016-07-20","2016-07-21","2016-07-22","2016-07-23","2016-07-24","2016-07-25","2016-07-26","2016-07-27"],
"Osallistun koko purkuleirille (4 päivää) ja saan alennusta leirimaksusta 20 euroa. Alennuksen saa käteisellä purkuleiriltä poistuttaessa.": ["2016-07-28","2016-07-29","2016-07-30","2016-07-31"],
"Osallistun koko purkuleirille (4 päivää) ja saan alennusta leirimaksusta 20 euroa. Summa hyvitetään purkuleirin jälkeen..": ["2016-07-28","2016-07-29","2016-07-30","2016-07-31"],
"Osallistun vain rakennus-/purkuleirille tai Home Hospitalityn isäntäperheenä.": []
}
6 changes: 4 additions & 2 deletions src/common/models/participant.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ export default function (Participant) {

if (where.and) {
dates = where.and.filter(filter => filter.dates);
dates = dates.dates;
where.and = where.and.filter(filter => !filter.dates);
if (dates && !_.isEmpty(dates)) {
dates = dates[0].dates;
where.and = where.and.filter(filter => !filter.dates);
}
} else {
dates = where.dates;
}
Expand Down
2 changes: 0 additions & 2 deletions src/kuksa-integration/rebuild-tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ function rebuildParticipantsTable() {
function getSubCamp(participant) {
if (participant.accommodation === 'Perheleirissä') {
return 'Riehu';
} else if (getSelectionForGroup(participant, 'Osallistun seuraavan ikäkauden ohjelmaan:') === 'perheleirin ohjelmaan (0-11v.), muistathan merkitä lisätiedot osallistumisesta \"vain perheleirin osallistujille\" -osuuteen.') {
return 'Riehu';
}
return _.get(participant, 'subCamp.name') || 'Muu';
}
Expand Down
8 changes: 4 additions & 4 deletions test/date-search.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('Date search', () => {
'campGroup': 'Leirilippukunta',
'village': 'Kylä',
'subCamp': 'Alaleiri2',
'ageGroup': 'sudenpentu',
'ageGroup': 'seikkailija',
'memberNumber': 345,
},
{
Expand Down Expand Up @@ -104,7 +104,7 @@ describe('Date search', () => {
it('Query with other filter', () =>
queryParticipants({ 'ageGroup':'sudenpentu' }, accessToken)
.then(res => {
expectParticipants([ 'Tero', 'Teemu' ], res.body);
expectParticipants([ 'Teemu' ], res.body);
})
);

Expand All @@ -116,14 +116,14 @@ describe('Date search', () => {
);

it('Query with one date', () =>
queryParticipants({ 'dates': ['2016-07-23T00:00:00.000Z'] }, accessToken)
queryParticipants({ 'dates': ['2016-07-22T00:00:00.000Z'] }, accessToken)
.then(res => {
expectParticipants([ 'Tero', 'Teemu' ], res.body);
})
);

it('Query with one date and other filter', () =>
queryParticipants({ 'and': [ { 'dates': ['2016-07-23T00:00:00.000Z'] }, { 'subCamp': 'Alaleiri2' } ] }, accessToken)
queryParticipants({ 'and': [ { 'dates': ['2016-07-23T00:00:00.000Z'] }, { 'ageGroup': 'seikkailija' } ] }, accessToken)
.then(res => {
expectParticipants([ 'Tero' ], res.body);
})
Expand Down

0 comments on commit decf8c1

Please sign in to comment.