Other use case for Bingo Meetings was Share meeting bingo(https://github.com/alexandru360/PresentationBingoCards/projects/1#card-24165765)
Share Meeting Bingo:
As a User,I can receive the meeting Id( url) . When going to this url,I can ( optionally) enter my name and check cards.
So how to implement this ? A Meeting contains an array of Cards and a array of Participants. How a Participant can check cards ?
There are several solutions for this:
- The Participant can have an Id of the meeting,is going to some form of database( even in memory,like a singleton collection of Meetings),retrieve the meeting,retrieve the cards,check the card
- The participant raise an event ( PleaseCheckThisCardForMe),the meeting listens and checks the meeting
- The participant have a real reference of the cards and checks the cards
- The meeting has a CheckCardByParticipant that someone can call ( leaving the responsibility later – maybe on API )
We ( me and Alexandru Badita we have choosed the latest solution. So we came with the following :
public CheckCardByParticipant(c: Cards,p:Participant){ //TODO: verify participant is added first or add //TODO: verify card is added first c.CheckMe(p); }
and a test
import MeetingsFactory from '../MeetingsFactory'; import Meeting from '../meeting'; describe('Check card basic',() => { it('card should be checked',() => { const mf=new MeetingsFactory(); const m1=mf.CreateMeeting("andrei","first meeting"); console.log(m1.Cards.length); expect(m1.AllUnchecked()).toBe(true); m1.CheckCardByParticipant(m1.Cards[0],m1.Participants[0]); expect(m1.AllUnchecked()).toBe(false); expect(m1.IsCardCheckedByParticipant(m1.Cards[0],m1.Participants[0])).toBe(true); }) })
Obviously,from TODO,we have to put more code and more tests – but for the moment we think that nobody will want to break our application on purpose….
Leave a Reply