Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#268] [BUGFIX] Ré-initialisation de la page de résultats d'une campa…
…gne (pf-449). Merge pull request #268 from 1024pix/pf-449-bugfix-share-campaign-results
- Loading branch information
Showing
10 changed files
with
310 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export default function(schema, request) { | ||
|
||
const campaignCode = request.queryParams['filter[codeCampaign]']; | ||
|
||
if (campaignCode) { | ||
const campaign = schema.campaigns.findBy({ code: campaignCode }); | ||
|
||
if (campaign) { | ||
const assessment = schema.campaignParticipations.findBy({ campaignId: campaign.id }); | ||
|
||
if (assessment) { | ||
return schema.assessments.where({ id: assessment.id }); | ||
} | ||
} | ||
} | ||
|
||
return schema.assessments.all(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
export default function(schema) { | ||
return schema.campaignParticipations.find(['1']); | ||
import Response from 'ember-cli-mirage/response'; | ||
|
||
export default function(schema, request) { | ||
const assessmentId = request.queryParams['filter[assessmentId]']; | ||
|
||
if (assessmentId) { | ||
const campaignParticipations = schema.campaignParticipations.where({ assessmentId }); | ||
if (campaignParticipations.length === 0) { | ||
return new Response(404); | ||
} | ||
return campaignParticipations; | ||
} | ||
return schema.campaignParticipations.all(); | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.