Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.2.1 attendence #81

Merged

Conversation

YuunoKun
Copy link

@YuunoKun YuunoKun commented Oct 2, 2020

Implements new Attendance feature together with Session/SessionList.
This PR does not guarantee the functionality of the Participate and Presence command, as it can only be completely done during integration (It needs to 'enter a session' which will have to acquire SessionName internally).

# Conflicts:
#	src/main/java/seedu/address/commons/core/Messages.java
#	src/main/java/seedu/address/logic/parser/AddressBookParser.java
@YuunoKun YuunoKun added this to the v1.2.1 milestone Oct 2, 2020
This was linked to issues Oct 2, 2020
Copy link

@marcustw marcustw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work Sheng Yang!

@@ -9,6 +9,7 @@
public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s";
public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The student index provided is invalid";
public static final String MESSAGE_PERSONS_LISTED_OVERVIEW = "%1$d students listed!";
public static final String MESSAGE_SESSION_DOES_NOT_EXIST = "The session does not exist";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps missing a fullstop?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this, the punctuation isn't consistent for other message strings too. I guess we can clean this up after integration.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing!

}

/**
* Standardize date string into the format of dd/MM/yyyy.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps "Standardizes" instead of "Standardize"?

* Signals that the operation will result in duplicate Classes (Classes are considered duplicates if they have the same
* date).
*/
public class SessionNotFoundException extends RuntimeException{}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a missing space between RunTimeException and "{}"?

/**
* Jackson-friendly version of {@link Attributes}.
*/
public class JsonAdaptedAttributes {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

Copy link

@erisjacey erisjacey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing job! Just some minor nitpicks with regard to code styling (mostly just unnecessary line breaks/white spaces, a few naming alternatives to consider).

Stellar job nonetheless 😄 This is really top-notch effort.

public static final String COMMAND_WORD = "clearsession";
public static final String MESSAGE_SUCCESS = "The session in the current session list has been cleared";


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this unncessary extra line break be removed?

Comment on lines +13 to +14
public static final Prefix PREFIX_SESSIONNAME = new Prefix("s/");
public static final Prefix PREFIX_SESSIONDATE = new Prefix("d/");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe these could be renamed to PREFIX_SESSION_NAME and PREFIX_SESSION_DATE?

Comment on lines +178 to +200
if (sessions.size() != ((SessionList) other).getSessions().size()) {
return false;
}

Session[] testArray1 = new Session[sessions.size()];
Session[] testArray2 = new Session[sessions.size()];

int i = 0;
int j = 0;
for (Session s: sessions) {
testArray1[i] = s;
i++;
}
for (Session s: ((SessionList) other).getSessions()) {
testArray2[j] = s;
j++;
}

for (int k = 0; k < sessions.size(); k++) {
if (!testArray1[k].isSameSession(testArray2[k])) {
return false;
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe some comments could be added here to more clearly explain the thought process?

*/
public class JsonAdaptedSession {


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary additional line break?

@@ -18,6 +19,7 @@
import seedu.address.model.person.NameContainsKeywordsPredicate;
import seedu.address.testutil.AddressBookBuilder;


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary line break?


import org.junit.jupiter.api.Test;


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary line break?


import org.junit.jupiter.api.Test;


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary line break?

Comment on lines +20 to +21


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary whitespaces?

Comment on lines +16 to +19




Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary whitespaces?

}

@Override
public void addPerson(Person person) {
for (Session s: sessionList.getSessions()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove this and use run in debug mode when its finalised


@Test
public void execute_sessionAcceptedByModel_addSuccessful() throws Exception {
ModelStubAcceptingSessionAdded modelStub = new ModelStubAcceptingSessionAdded();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like your usage of stubs!

* Returns if a given string is a valid index range.
*/
public static boolean isValidIndexRange(String test) {
return test.matches(VALIDATION_REGEX_1) || test.matches(VALIDATION_REGEX_2);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pattern.matches throw some exceptions when dealing with some corner cases like. Perhaps String.matches() do as well?

@@ -17,16 +16,26 @@
*/
public class Session implements Comparable<Session> {

private final LocalDate date;
private final SessionName sessionName;
private final SessionDate sessionDate;
private final Map<Integer, Attributes> studentList;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps studentAttributesList would be better here?

Copy link

@CodingCookieRookie CodingCookieRookie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@CodingCookieRookie CodingCookieRookie merged commit b013946 into AY2021S1-CS2103T-W16-4:master Oct 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Take attendance Track attendance progress
4 participants