Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/family camp #125

Merged
merged 6 commits into from
Jul 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/common/models/kuksa-participant.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,18 @@
"nullable": "YES"
}
},
"accommodation": {
"type": "string",
"required": false,
"postgresql": {
"columnName": "accommodation",
"dataType": "character varying",
"dataLength": 255,
"dataPrecision": null,
"dataScale": null,
"nullable": "YES"
}
},
"cancelled": {
"type": "boolean",
"postgresql": {
Expand Down
12 changes: 12 additions & 0 deletions src/common/models/participant.json
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,18 @@
"nullable": "NO"
}
},
"accommodation": {
"type": "string",
"required": false,
"postgresql": {
"columnName": "accommodation",
"dataType": "character varying",
"dataLength": 255,
"dataPrecision": null,
"dataScale": null,
"nullable": "YES"
}
},
"ageGroup": {
"type": "string",
"required": true,
Expand Down
1 change: 1 addition & 0 deletions src/kuksa-integration/fetch-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ function transferParticipants(eventApi) {
subCampId: participant.subCamp,
cancelled: participant.cancelled,
diet: participant.diet,
accommodation: participant.accommodation,
}),
dateRange: daterange,
},
Expand Down
6 changes: 5 additions & 1 deletion src/kuksa-integration/rebuild-tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ function rebuildParticipantsTable() {
}

function getSubCamp(participant) {
if (getSelectionForGroup(participant, 'Osallistun seuraavan ikäkauden ohjelmaan:') === 'perheleirin ohjelmaan (0-11v.), muistathan merkitä lisätiedot osallistumisesta \"vain perheleirin osallistujille\" -osuuteen.') {
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 Expand Up @@ -94,6 +96,7 @@ function rebuildParticipantsTable() {
email: participant.email,
internationalGuest: !!participant.localGroup,
diet: participant.diet,
accommodation: participant.accommodation,
localGroup: participant.representedParty || _.get(participant, 'localGroup.name') || 'Muu',
campGroup: _.get(participant, 'campGroup.name') || 'Muu',
subCamp: getSubCamp(participant),
Expand Down Expand Up @@ -192,6 +195,7 @@ function buildSelectionTable() {
.then(participants => Promise.each(participants, p =>
findKuksaParticipantExtraSelections({ where: { participantId: p.participantId }, include: { selection: 'group' } })
.then(participantSelections => participantSelections.map(selections => selections.toObject()))
.then(participantSelections => _.filter(participantSelections, s => !!(s.selection && s.selection.group))) // Apparently some selections don't have a group, so handle only selections with group
.then(participantSelections => _.filter(participantSelections, s => (_.indexOf(groupsToCreate, s.selection.group.name) > -1)))
.then(participantSelections => participantSelections.map(sel => ({
participantId: sel.participantId,
Expand Down