Skip to content

Commit 7025aa4

Browse files
author
GeNiaaz
authored
Merge pull request nus-cs2103-AY2021S1#71 from T-Fang/Update-Participation-Class
Update Participation class and create corresponding methods in Project
2 parents ac5b8a9 + 3fd585e commit 7025aa4

File tree

4 files changed

+79
-18
lines changed

4 files changed

+79
-18
lines changed

docs/team/T-Fang.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,19 @@ Taskmania (based off AB3) is a **desktop app for a project leader to manage team
1313
Given below are my contributions to the project.
1414

1515
* **Model modification**: Added basic dependencies of Participation.
16-
* What it means: basic management of participations.
16+
* What it means: basic management of Participation.
1717
* What changes made:
1818
* added dependencies of it in and related collections;
1919
* added related test cases.
2020

21+
* **Model modification**: Update Participation class and create corresponding methods in Project. (Pull request: Pull request [\#71](https://github.com/AY2021S1-CS2103T-W10-3/tp/pull/71))
22+
* What it means: Participation class is updated after creation of Meeting class and Task class
23+
* What changes made:
24+
* avoided cyclic dependencies between Participation class and Meeting class
25+
* Meeting class no longer keeps track of its assignees.
26+
* Added methods in Participation and Project to get assignees of a specific meeting.
27+
* Added more methods in Participation.
28+
2129
* **New Feature**:
2230

2331
* **Code contributed**: [RepoSense link](https://nus-cs2103-ay2021s1.github.io/tp-dashboard/#breakdown=true&search=&sort=groupTitle&sortWithin=title&since=2020-08-14&timeframe=commit&mergegroup=&groupSelect=groupByRepos&checkedFileTypes=docs~functional-code~test-code~other&tabOpen=true&tabType=authorship&zFR=false&tabAuthor=T-Fang&tabRepo=AY2021S1-CS2103T-W10-3%2Ftp%5Bmaster%5D&authorshipIsMergeGroup=false&authorshipFileTypes=docs~functional-code~test-code)
@@ -29,8 +37,9 @@ Given below are my contributions to the project.
2937
* **Documentation**:
3038
* User Guide:
3139
* Added documentation for basic task-related features.
40+
* Came up with the first draft of feature list.
3241
* Developer Guide:
33-
* Wrote first draft of non-functional requirements.
42+
* Wrote first draft of non-functional requirements. (Pull Request [\#54](https://github.com/AY2021S1-CS2103T-W10-3/tp/pull/54))
3443

3544
* **Community**:
3645
* Updated `README.md` for team repository.

src/main/java/seedu/address/model/meeting/Meeting.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
import java.time.LocalDate;
33
import java.time.LocalDateTime;
44
import java.time.temporal.Temporal;
5-
import java.util.ArrayList;
6-
7-
import seedu.address.model.person.Person;
85

96
public class Meeting {
107
private String name;
@@ -17,7 +14,6 @@ public class Meeting {
1714
private LocalDate endDate;
1815
private String note;
1916
private boolean isDone;
20-
private ArrayList<Person> attendees = new ArrayList<>();
2117

2218
/**
2319
* Constructor for meeting.
@@ -36,17 +32,10 @@ public void done() {
3632
isDone = true;
3733
}
3834

39-
public ArrayList<Person> getAttendees() {
40-
return attendees;
41-
}
42-
4335
public String getName() {
4436
return name;
4537
}
4638

47-
public void addAttendee(Person person) {
48-
attendees.add(person);
49-
}
5039

5140
public String getDescription() {
5241
return description;

src/main/java/seedu/address/model/project/Participation.java

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,65 @@ public Participation(Person person, Project project) {
3333
}
3434

3535
/**
36-
* indicates attendance for the meeting
36+
* Alternative constructor that allows specifying the role of the person
37+
*/
38+
public Participation(Person person, Project project, Role role) {
39+
this.person = person;
40+
this.project = project;
41+
this.role = role;
42+
tasks = new HashSet<>();
43+
meetings = new HashSet<>();
44+
}
45+
public void changeRole(Role role) {
46+
this.role = role;
47+
}
48+
/**
49+
* Indicates attendance for the meeting.
3750
*
3851
* @param meeting meeting to attend
3952
*/
4053
public void attends(Meeting meeting) {
41-
meeting.addAttendee(person);
4254
meetings.add(meeting);
43-
project.getMeetings().add(meeting);
55+
project.addMeeting(meeting);
4456
}
4557

46-
enum Role {
47-
LEADER, MEMBER;
58+
/**
59+
* Assigns task to the person
60+
* @param task task to be assigned
61+
*/
62+
public void addTask(Task task) {
63+
tasks.add(task);
64+
project.addTask(task);
4865
}
66+
/**
67+
* Checks whether the person is an attendee of the meeting.
68+
* @param meeting meeting to check
69+
* @return true if the person is an attendee of the meeting, and false otherwise
70+
*/
71+
public boolean isAttendeeOf(Meeting meeting) {
72+
return meetings.contains(meeting);
73+
}
74+
75+
/**
76+
* Checks whether the person has the given task.
77+
* @param task the task to check
78+
* @return true if the person is assigned to do the task, and false otherwise.
79+
*/
80+
public boolean hasTask(Task task) {
81+
return tasks.contains(task);
82+
}
83+
public Person getPerson() {
84+
return person;
85+
}
86+
public Project getProject() {
87+
return project;
88+
}
89+
public Role getRole() {
90+
return role;
91+
}
92+
}
4993

94+
enum Role {
95+
LEADER, MEMBER;
5096
}
5197

src/main/java/seedu/address/model/project/Project.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import java.util.Collections;
66
import java.util.HashMap;
77
import java.util.HashSet;
8+
import java.util.Map;
89
import java.util.Objects;
910
import java.util.Set;
1011

@@ -66,7 +67,23 @@ public Address getAddress() {
6667
public Set<Meeting> getMeetings() {
6768
return meetings;
6869
}
70+
public boolean addMeeting(Meeting meeting) {
71+
return meetings.add(meeting);
72+
}
73+
public boolean addTask(Task task) {
74+
return tasks.add(task);
75+
}
6976

77+
/**
78+
* Gets all attendees of a specific meeting
79+
*/
80+
public Set<Person> getAttendeesOfMeeting(Meeting meeting) {
81+
HashSet<Person> attendees = new HashSet<Person>();
82+
for (Map.Entry<PersonName, Participation> entry: listOfParticipations.entrySet()) {
83+
attendees.add(entry.getValue().getPerson());
84+
}
85+
return attendees;
86+
}
7087
/**
7188
* Returns an immutable tag set, which throws {@code UnsupportedOperationException}
7289
* if modification is attempted.

0 commit comments

Comments
 (0)