Skip to content

Instantly share code, notes, and snippets.

@carlosble
Created May 13, 2021 16:39
Show Gist options
  • Save carlosble/2c6987a3f5800edc734706c8a0888960 to your computer and use it in GitHub Desktop.
Save carlosble/2c6987a3f5800edc734706c8a0888960 to your computer and use it in GitHub Desktop.
//
class Rating {}
class SessionSequence {
private int sequenceNumber;
public SessionSequence(int sequenceNumber){
this.sequenceNumber = sequenceNumber;
}
public boolean isPreviousTo(SessionSequence sequence){
return this.sequenceNumber > sequence.sequenceNumber;
}
}
class SessionGroup {
private Participant[] participants;
private SessionSequence sessionNumber;
private Topic topic;
private Rating rating;
public SessionGroup(SessionSequence sessionNumber, Topic topic, Participant ...participants) {
this.topic = topic;
this.sessionNumber = sessionNumber;
this.participants = participants;
}
}
class Participant {
private String name;
public Participant(String name) {
this.name = name;
}
}
class Topic {}
/* Dado que 2 sesiones atras los grupos fueron:
- Carlos, Laura, Inma
- Airan, Atanas, Kevin
- Irene, Ariadna, Daniel
Y que la sesion previa hubo estas personas:
- Airan, Atanas, Kevin
- Irene, Ariadna, Daniel
Y que en la sesion de hoy los participantes son:
- Carlos, Laura, Inma, Airan, Atanas, Kevin, Irene, Ariadna, Daniel
Cuando pido los grupos de la sesion de hoy el resultado es:
- Carlos, Laura, Inma
- Airan, Atanas, Kevin
- Irene, Ariadna, Daniel
*/
/* Dado que 3 sesiones atras los grupos fueron:
- Carlos, Laura, Inma
- Airan, Atanas, Kevin
- Irene, Ariadna, Daniel
Y que la sesion siguiente hubo estas personas:
- Carlos
- Airan, Atanas, Kevin
- Irene, Ariadna, Daniel
Y que en la sesion siguiente hubo estas personas:
- Carlos
- Airan, Atanas, Kevin
- Irene, Ariadna, Daniel
Y que en la sesion de hoy los participantes son:
- Carlos, Laura, Inma, Airan, Atanas, Kevin, Irene, Ariadna, Daniel
Cuando pido los grupos de la sesion de hoy el resultado es:
- Laura, Inma
- Airan, Atanas, Kevin, Carlos
- Irene, Ariadna, Daniel
*/
class SessionHistory {
public List<SessionGroup> findPreviousGroupsFrom(SessionSequence sequence, Topic topic){
return null;
}
public void storeSession(List<SessionGroup> sessionGroups){
}
}
class SessionId {
}
/*
SessionId could be a Zoom id
*/
class SessionReader {
public List<Participant> currentParticipants(SessionId sessionId) {
return null;
}
}
class SessionInfo {
SessionId sessionId;
SessionSequence sequence;
Topic topic;
public SessionInfo(SessionId sessionId, SessionSequence sequence, Topic topic) {
this.sessionId = sessionId;
this.sequence = sequence;
this.topic = topic;
}
public SessionId sessionId() {
return sessionId;
}
public SessionSequence sequence() {
return sequence;
}
public Topic topic() {
return topic;
}
}
class SessionService {
SessionReader reader;
SessionOrganizer organizer;
SessionHistory history;
public List<SessionGroup> getGroupsForSubsequentSession(SessionInfo sessionInfo){
var participants = reader.currentParticipants(sessionInfo.sessionId());
var previousGroups = history.findPreviousGroupsFrom(sessionInfo.sequence(), sessionInfo.topic());
return organizer.getGroupsForSubsequentSession(participants, previousGroups);
}
}
class SessionOrganizer {
public List<SessionGroup> getGroupsForSubsequentSession(List<Participant> sessionParticipants,
List<SessionGroup> groupsFromPreviousSession){
return null;
}
}
public class Tests {
/* @Test
public void a_subsequent_session_should_have_the_same_groups_than_the_previous_session(){
SessionOrganizer organizer = new SessionOrganizer();
var anaVanesa = new Participant("Ana Vanesa");
var ivan = new Participant("Ivan");
var laura = new Participant("Laura");
var ariadna = new Participant("Ariadna");
var emma = new Participant("Emma");
var irene = new Participant("Irene");
var michael = new Participant("Michael");
var santiago = new Participant("Santiago");
List<Participant> participants = List.of(anaVanesa, ivan, laura, ariadna, emma, irene);
List<SessionGroup> previousSessionGroups = List.of(new SessionGroup(anaVanesa, ivan, laura),
new SessionGroup(ariadna, emma, irene, michael, santiago));
var actualSessionGroups = organizer.getGroupsForSubsequentSession(participants, previousSessionGroups);
List<SessionGroup> expectedSessionGroups = List.of(new SessionGroup(anaVanesa, ivan, laura),
new SessionGroup(ariadna, emma, irene));
assertThat(actualSessionGroups).isEqualTo(expectedSessionGroups);
}
*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment