Skip to content

Commit

Permalink
Merge pull request #171 from MuhdNurKamal/improve-GUI
Browse files Browse the repository at this point in the history
Improve Polls GUI
  • Loading branch information
amrut-prabhu authored Apr 6, 2018
2 parents 95de85d + fd67b22 commit 5d75fea
Show file tree
Hide file tree
Showing 34 changed files with 134 additions and 88 deletions.
36 changes: 34 additions & 2 deletions docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ A member can have any number of tags (including 0).
The `group` attribute is an optional attribute.
A member will be assigned to the default group `Member` if no group is specified in the command.

[NOTE]
This command is for `EXCO` members only.

Examples:

* `add n/John Doe p/98765432 e/johnd@example.com m/A1234567H`
Expand All @@ -139,6 +142,9 @@ The options to choose from are Monday, Wednesday and Friday.
Creates a poll asking members to vote where the annual sports meeting should be held.
The answers to choose from are I-Cube and LT7.

[NOTE]
This command is for `EXCO` members only.

=== Adding a task: `addtask` (Since v1.3)

Adds a task to Club Connect. +
Expand Down Expand Up @@ -175,6 +181,8 @@ Alias: `assignt`
*****
[NOTE]
Duplicate tasks are not allowed.
[NOTE]
This command is for `EXCO` members only.

This command assigns the task to the member based on the entered `NAME`.

Expand Down Expand Up @@ -268,6 +276,8 @@ Aliases: `c`, `erase`
* LETTER must be equals to "Y" to confirm clearing data from Club Connect
* Any other LETTER will cancell the execution
****
[NOTE]
This command is for `EXCO` members only.

Examples:

Expand Down Expand Up @@ -310,6 +320,8 @@ Aliases: `del`, `rm`, `remove`
* The index refers to the index number shown in the most recent listing.
* The index *must be a positive integer* 1, 2, 3, ...
****
[NOTE]
This command is for `EXCO` members only.

Examples:

Expand All @@ -331,6 +343,8 @@ Aliases: `rmpoll`, `delpoll`
* The index refers to the index number shown in the most recent poll listing.
* The index *must be a positive integer* 1, 2, 3, ...
****
[NOTE]
This command is for `EXCO` members only.

Examples:

Expand All @@ -344,6 +358,8 @@ Deletes the 4th poll in the poll listing.
Deletes the specified tag for all members in the Club Connect. +
Format: `deletetag t/TAG` +
Aliases: `rmtag`, `deltag`
[NOTE]
This command is for `EXCO` members only.

****
* Deletes the specified tag from Club Connect.
Expand Down Expand Up @@ -393,6 +409,8 @@ Aliases: `e`, `update`
* When editing tags, the existing tags of the member will be removed i.e adding of tags is not cumulative.
* You can remove all the member's tags by typing `t/` without specifying any tags after it.
****
[NOTE]
This command is for `EXCO` members only.

Examples:

Expand Down Expand Up @@ -500,9 +518,12 @@ Aliases : `h`, `info`

=== Hiding results of polls : `hideresults` (Since v1.4)

Hides the results of all polls in Club Connect. This is a command that can be used to remove clutter from poll results. +
Hides the results of all polls in Club Connect. This is a command that can be used by `EXCO` members only to remove clutter from poll results. +
Format: `hideresults` +
Alias: `hideres`
[NOTE]
This command is for `EXCO` members only.


=== Listing entered commands : `history`

Expand Down Expand Up @@ -530,6 +551,9 @@ Alias: `imp`
[NOTE]
You can save a Microsoft Excel spreadsheet as a CSV file by changing the file extension while saving.

[NOTE]
This command is for `EXCO` members only.

Examples:

* `import C:/Users/John Doe/Desktop/members.csv` +
Expand Down Expand Up @@ -591,6 +615,8 @@ Aliases: `rmgroup`, `delgroup`
* The group must exist in Club Connect.
* The group must be in valid format (i.e. no white-spaces and non-empty).
****
[NOTE]
This command is for `EXCO` members only.

Examples:

Expand Down Expand Up @@ -623,11 +649,15 @@ Selects the 1st member in the results of the `find` command.

=== Showing results of polls : `showresults` (Since v1.4)

Displays the results of polls in Club Connect. This is a command that can be used to monitor polls in the Club Connect. +
Displays the results of polls in Club Connect. This is a command that can be used by `EXCO` members only to monitor polls in the Club Connect. +
Results include number of voters for each answer of a poll and total number of voters who took part in the poll. Results are anonymous. +
Format: `showresults` +
Alias: `showres`

[NOTE]
This command is for `EXCO` members only.


=== Signing up a member: `signup` (since v1.4)
Signs up a member to Club Connect. +
Format: `signup n/NAME p/PHONE_NUMBER e/EMAIL m/MATRIC_NUMBER [t/TAG]...` +
Expand Down Expand Up @@ -676,6 +706,8 @@ The `undo` command fails as there are no undoable commands executed previously.
Displays all the tasks created/assigned in Club Connect. This is a command that can be used by `EXCO` members to monitor all the tasks in the club. +
Format: `viewalltasks` +
Alias: `alltasks`
[NOTE]
This command is for `EXCO` members only.

[NOTE]
This command can only be invoked by `EXCO` members.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package seedu.club.commons.events.ui;

//@@author MuhdNurKamal
import seedu.club.commons.events.BaseEvent;

/**
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package seedu.club.commons.events.ui;

//@@author MuhdNurKamal
import seedu.club.commons.events.BaseEvent;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package seedu.club.logic.commands;

//@@author MuhdNurKamal
import static java.util.Objects.requireNonNull;
import static seedu.club.logic.parser.CliSyntax.PREFIX_ANSWER;
import static seedu.club.logic.parser.CliSyntax.PREFIX_QUESTION;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package seedu.club.logic.commands;

//@@author MuhdNurKamal
import java.util.ArrayList;
import java.util.Arrays;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package seedu.club.logic.commands;

//@@author MuhdNurKamal
import java.util.ArrayList;
import java.util.Arrays;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package seedu.club.logic.commands;

//@@author MuhdNurKamal
import static java.util.Objects.requireNonNull;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package seedu.club.logic.commands;

//@@author MuhdNurKamal
import java.util.ArrayList;
import java.util.Arrays;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package seedu.club.logic.parser;

//@@author MuhdNurKamal
import static seedu.club.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.club.logic.parser.CliSyntax.PREFIX_ANSWER;
import static seedu.club.logic.parser.CliSyntax.PREFIX_QUESTION;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package seedu.club.logic.parser;

//@@author MuhdNurKamal
import static seedu.club.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;

import seedu.club.commons.core.index.Index;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/seedu/club/logic/parser/FindCommandParser.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package seedu.club.logic.parser;

//@@author MuhdNurKamal
import static seedu.club.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.club.logic.parser.CliSyntax.PREFIX_EMAIL;
import static seedu.club.logic.parser.CliSyntax.PREFIX_GROUP;
Expand All @@ -19,7 +19,7 @@
*/
public class FindCommandParser implements Parser<FindCommand> {

private static Prefix[] prefixes = {PREFIX_NAME, PREFIX_EMAIL, PREFIX_PHONE,
private static final Prefix[] VALID_SEARCH_PREFIXES = {PREFIX_NAME, PREFIX_EMAIL, PREFIX_PHONE,
PREFIX_MATRIC_NUMBER, PREFIX_GROUP, PREFIX_TAG};

/**
Expand All @@ -40,7 +40,7 @@ public FindCommand parse(String args) throws ParseException {
throw new ParseException(
String.format(MESSAGE_INVALID_COMMAND_FORMAT, FindCommand.MESSAGE_USAGE));
} else if (findArgs.length > 1) {
for (Prefix prefix : prefixes) {
for (Prefix prefix : VALID_SEARCH_PREFIXES) {
if (findArgs[0].equalsIgnoreCase(prefix.toString())) {
return new FindCommand(new FieldContainsKeywordsPredicate(
Arrays.asList(findArgs).subList(1, findArgs.length), prefix));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/club/logic/parser/ParserUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ public static Optional<Answer> parseOptionalAnswer(Optional<String> answer) thro
}

/**
* Parses {@code Collection<String> tags} into a {@code List<Answer>}.
* Parses {@code Collection<String> answers} into a {@code List<Answer>}.
* Removes any duplicates if any
*/
public static List<Answer> parseAnswers(Collection<String> answers) throws IllegalValueException {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/seedu/club/model/ClubBook.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
Expand Down Expand Up @@ -90,7 +91,7 @@ public void setTags(Set<Tag> tags) {
public void resetData(ReadOnlyClubBook newData) {
requireNonNull(newData);
setTags(new HashSet<>(newData.getTagList()));
setPolls(new HashSet<>(newData.getPollList()));
setPolls(new LinkedHashSet<>(newData.getPollList()));
setTasks(new HashSet<>(newData.getTaskList()));
List<Member> syncedMemberList = newData.getMemberList().stream()
.map(this::syncWithMasterTagList)
Expand Down
1 change: 1 addition & 0 deletions src/main/java/seedu/club/model/ModelManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ public void signUpMember(Member member) throws MemberListNotEmptyException {
filteredMembers.setPredicate(PREDICATE_NOT_SHOW_ALL_MEMBERS);
indicateClubBookChanged();
}
//@@author

@Override
public void clearClubBook() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package seedu.club.model.poll.exceptions;
//@@author MuhdNurKamal
/**
* Signals that the operation is unable to find the specified poll.
* Signals that the operation is unable to find the specified answer.
*/
public class AnswerNotFoundException extends Exception {}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package seedu.club.model.poll.exceptions;
//@@author MuhdNurKamal
/**
* Signals that the operation is unable to find the specified poll.
* Signals that the current logged in member has already voted for the poll.
*/
public class UserAlreadyVotedException extends Exception {}
17 changes: 11 additions & 6 deletions src/main/java/seedu/club/ui/AnswerCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//@@author MuhdNurKamal
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.control.ProgressBar;
import javafx.scene.layout.Region;
import seedu.club.model.poll.Answer;

Expand All @@ -13,6 +13,7 @@ public class AnswerCard extends UiPart<Region> {

private static final String FXML = "AnswerListCard.fxml";
private static final String DESCRIPTION_VOTE_COUNT = "Vote Count: ";
private static final String PERCENTAGE_SYMBOL = "%";
private final int totalVoteCount;

@FXML
Expand All @@ -25,7 +26,10 @@ public class AnswerCard extends UiPart<Region> {
private Label voteCount;

@FXML
private ProgressIndicator voteCountIndicator;
private ProgressBar votePercentageBar;

@FXML
private Label votePercentage;

/**
* A constructor to initialize AnswerCard using {@value FXML} with results
Expand All @@ -36,7 +40,7 @@ public AnswerCard(Answer answer, int displayedIndex, int totalVoteCount) {
choice.setText(displayedIndex + ". ");
answerValue.setText(answer.getValue());
voteCount.setText(DESCRIPTION_VOTE_COUNT + answer.getVoteCount());
setVoteCountIndicator(answer);
setVotePercentage(answer);
}

/**
Expand All @@ -51,11 +55,12 @@ public AnswerCard(Answer answer, int displayedIndex, int totalVoteCount, String
answerValue.setText(answer.getValue());
}

private void setVoteCountIndicator(Answer answer) {
private void setVotePercentage(Answer answer) {
int voteCount = answer.getVoteCount();
double progress = totalVoteCount == 0
double voteFraction = totalVoteCount == 0
? 0 : ((double) voteCount) / totalVoteCount;
voteCountIndicator.setProgress(progress);
votePercentageBar.setProgress(voteFraction);
votePercentage.setText((Math.round(voteFraction * 1000)) / 10 + PERCENTAGE_SYMBOL);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/club/ui/AnswerListPanel.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package seedu.club.ui;

//@@author MuhdNurKamal
import java.util.logging.Logger;

import javafx.collections.ObservableList;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/club/ui/PollCard.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package seedu.club.ui;

//@@author MuhdNurKamal
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/club/ui/PollListPanel.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package seedu.club.ui;

//@@author MuhdNurKamal
import java.util.logging.Logger;

import org.fxmisc.easybind.EasyBind;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/club/ui/RestrictedPollCard.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package seedu.club.ui;

//@@author MuhdNurKamal
import seedu.club.model.poll.Poll;

/**
Expand Down
Loading

0 comments on commit 5d75fea

Please sign in to comment.