-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add verbose report of PoC participation
Can check a box in #6 now!
- Loading branch information
Showing
4 changed files
with
67 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
var trinaryCounter = require('./trinary-counter'); | ||
|
||
class RaceParticipantCountReportGenerator { | ||
constructor(userMessages, userIsPersonOfColour) { | ||
this.userMessages = userMessages; | ||
this.userIsPersonOfColour = userIsPersonOfColour; | ||
} | ||
|
||
generate() { | ||
return trinaryCounter( | ||
this.userMessages, | ||
this.userIsPersonOfColour, | ||
{ | ||
'true': 'peopleOfColour', | ||
'false': 'whitePeople', | ||
'else': 'unknown' | ||
} | ||
); | ||
} | ||
} | ||
|
||
module.exports = RaceParticipantCountReportGenerator; |
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,37 @@ | ||
// TODO there’s little difference between this and the gender report; | ||
// the calculators are simple wrappers for trinaryCounter and trinaryGrouper | ||
|
||
var messageAndParticipantTable = require('./message-and-participant-table'); | ||
|
||
var RaceMessageCountStatisticsGenerator = require('../calculators/race-message-count'); | ||
|
||
var RaceParticipantCountStatisticsGenerator = require('../calculators/race-participant-count'); | ||
|
||
class VerboseRaceReportGenerator { | ||
constructor(userMessageCount, userIsPersonOfColour) { | ||
this.userMessageCount = userMessageCount; | ||
this.userIsPersonOfColour = userIsPersonOfColour; | ||
} | ||
|
||
generate() { | ||
var messageCountStatistics = new RaceMessageCountStatisticsGenerator(this.userMessageCount, this.userIsPersonOfColour).generate(); | ||
|
||
var participantCountStatistics = new RaceParticipantCountStatisticsGenerator(this.userMessageCount, this.userIsPersonOfColour).generate(); | ||
|
||
var table = messageAndParticipantTable( | ||
messageCountStatistics, | ||
participantCountStatistics, | ||
{ | ||
'peopleOfColour': 'PoC', | ||
'whitePeople': 'not-PoC', | ||
'unknown': 'unknown' | ||
} | ||
); | ||
|
||
var report = '```\n' + table.toString() + '\n```'; | ||
|
||
return report; | ||
} | ||
} | ||
|
||
module.exports = VerboseRaceReportGenerator; |
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