Commit 1dc2dc15 authored by Valentin Le Gauche's avatar Valentin Le Gauche
Browse files

Merge branch...

Merge branch '52-ajouter-un-attribut-nombre-de-participants-a-la-classe-meetingscenario' into 'master'

Resolve "Ajouter un attribut "nombre de participants" à la classe MeetingScenario"

Closes #52

See merge request tx-techno-num/impactometre!48
parents cdfd5e4d 6346e330
......@@ -7,13 +7,14 @@ const MeetingScenario = require('../../model/classes/meeting/MeetingScenario')
* Create a scenario corresponding to a meeting and add it to the database.
* @param {String} user - The user who creates the scenario.
* @param {Number} meetingDuration - The scenario duration in minutes.
* @param {Number} numberOfParticipants - The number of people who participates in the meeting.
* @param {Object} payload - A JSON object that contains three arrays that enable to create the three
* category damages (hardware, software, transport) linked to the meeting. The payload is like:
* { [array_of_all_hardware_data], [array_of_all_software_data], [array_of_all_journey data]}.
*/
function create ({ user, meetingDuration, payload }) {
function create ({ user, meetingDuration, numberOfParticipants, payload }) {
// Create new MeetingScenario
const meetingScenario = new MeetingScenario({ user, meetingDuration, payload })
const meetingScenario = new MeetingScenario({ user, meetingDuration, numberOfParticipants, payload })
// Add it to the database
meetingScenarios.set(meetingScenario.id, meetingScenario)
......
......@@ -17,9 +17,10 @@ class MeetingScenario extends Scenario {
* @see MeetingDamage
* @see CategoryDamage
*/
constructor ({ user, meetingDuration, payload }) {
constructor ({ user, meetingDuration, numberOfParticipants, payload }) {
super(user)
this._meetingDuration = meetingDuration
this._numberOfParticipants = numberOfParticipants
this._damage = new MeetingDamage({
hardwareComponents: payload[meetingCategoryDamage.HARDWARE],
softwareComponents: payload[meetingCategoryDamage.SOFTWARE],
......@@ -51,6 +52,10 @@ class MeetingScenario extends Scenario {
return this._damage
}
get numberOfParticipants () {
return this._numberOfParticipants
}
// Setters
/**
......@@ -75,6 +80,10 @@ class MeetingScenario extends Scenario {
this._damage = damage
}
set numberOfParticipants (numberOfParticipants) {
this._numberOfParticipants = numberOfParticipants
}
// Other methods
/**
......
......@@ -13,6 +13,8 @@ describe('meetingScenario controller', () => {
const user = 'vlegauch'
// The meeting duration in minutes
const meetingDuration = 120
// Number of participants
const numberOfParticipants = 4
// The JSON object that enables to creates components linked to the meeting
const payload = {
[meetingCategoryDamage.HARDWARE]: [
......@@ -59,7 +61,7 @@ describe('meetingScenario controller', () => {
}
]
}
create({ user, meetingDuration, payload })
create({ user, meetingDuration, numberOfParticipants, payload })
describe('#create()', () => {
// Create the meeting scenario
it('shoud create a meeting scenario and add it the database', () => {
......
......@@ -17,6 +17,8 @@ describe('MeetingScenario class', () => {
const user = 'vlegauch'
// The meeting duration in minutes
const meetingDuration = 120
// Number of participants
const numberOfParticipants = 4
// The JSON object that enables to creates components linked to the meeting
const payload = {
[meetingCategoryDamage.HARDWARE]: [
......@@ -64,7 +66,7 @@ describe('MeetingScenario class', () => {
]
}
// Create the MeetingScenario object
const meetingScenario = new MeetingScenario({ user, meetingDuration, payload })
const meetingScenario = new MeetingScenario({ user, meetingDuration, numberOfParticipants, payload })
// Create the JSON object that enables to compute meeting total damage
const damagePayload = {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment