Skip to content

Commit

Permalink
Resize image (#250)
Browse files Browse the repository at this point in the history
* Update UG and DG with clearer diagrams

* Resize UG image

* Correct grammatical error

* Correct grammatical error

* Update error message

* Update Number parameter type for custom properties

* Make changes to diagrams

* Remove HTML file

* Fix error message
  • Loading branch information
weihaw08 authored and t-cheepeng committed Nov 11, 2019
1 parent 07a6ddc commit ca5c741
Show file tree
Hide file tree
Showing 17 changed files with 29 additions and 24 deletions.
2 changes: 1 addition & 1 deletion docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ is just to ensure that a predefined command is entered and is passed to the corr
it directly.

2. If the data structure holding the `CustomProperty` object is to be made static, it means that this information is
shared among all of the `PropertyBook` instances if Choice 2 was implemented. Thus, `PropertyBook`
shared among all of the `PropertyBook` instances if Choice 2 is implemented. Thus, `PropertyBook`
is acting like a singleton and so, a singleton class will be appropriate.

//end::customfeature[]
Expand Down
28 changes: 14 additions & 14 deletions docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -820,8 +820,8 @@ property in the `add` and `edit` command to include information for the new prop
* Every word in the full name of each custom property will be changed to Start Case style, where the first letter of each
word is capitalised with the other letters in lower case e.g. `enD DaTe` will be changed to `End Date`.
* The date entered for custom properties with a `DATE` parameter must follow the same requirements as that of <<addexercise, add>> command.
* The text entered for custom properties with a `TEXT` parameter can contain only alphabets.
* The number entered for custom properties with a `NUMBER` parameter must be non-negative.
* The text entered for custom properties with a `TEXT` parameter can contain only alphabets and spaces.
* The number entered for custom properties with a `NUMBER` parameter must be a non-negative integer.
* You need not include the custom properties when adding a new exercise to the app.
****

Expand Down Expand Up @@ -855,7 +855,7 @@ image::CustomRating.png[align="center", width=85%, scaledwidth=15cm]

You can now add a new exercise with `Rating`!

* `add t/exercise n/Run d/07/11/2019 c/400 q/2.4 u/km r/5`
* `add t/exercise n/Dancing d/07/11/2019 c/400 q/2 u/hours r/5`

Expected Result:

Expand All @@ -881,33 +881,33 @@ Example:

* `custom rm/Rating`

Before the execution, the `Rating` property will be present in exercises that have them.
Before the execution, the `Rating` property will be present in exercises that have it.

.A rating of 4.5 for exercise 6
image::EditCustomRating.png[align="center", width=85%, scaledwidth=15cm]
.A rating of 5 for exercise 6
image::AddCustomRating.png[align="center", width=85%, scaledwidth=15cm]

.A rating of 3.5 for exercise 7
image::EditAnotherCustomRating.png[align="center", width=85%, scaledwidth=15cm]
.A rating of 3 for exercise 7
image::EditAnotherCustomrating.png[align="center", width=85%, scaledwidth=15cm]

After the execution, the `Rating` property will be removed from all of the exercises and the app
as illustrated in the next few figures.

.Rating in exercise 6 is removed
image::RunRatingRemoved.png[align="center", width=85%, scaledwidth=15cm]
image::DancingRatingRemoved.png[align="center", width=85%, scaledwidth=15cm]

.Rating in exercise 7 is also removed
image::BenchPressRatingRemoved.png[align="center", width=85%, scaledwidth=15cm]
image::RunningRatingRemoved.png[align="center", width=85%, scaledwidth=15cm]

// end::customfeature[]

* `custom rm/Rating i/6`

Before the execution, both exercises 6 and 7 have a rating attached to them.

.A rating of 4.5 for exercise 6
image::EditCustomRating.png[align="center", width=85%, scaledwidth=15cm]
.A rating of 5 for exercise 6
image::AddCustomRating.png[align="center", width=85%, scaledwidth=15cm]

.A rating of 3.5 for exercise 7
.A rating of 3 for exercise 7
image::EditAnotherCustomRating.png[align="center", width=85%, scaledwidth=15cm]

After the execution, only exercise 6 has its rating property removed.
Expand Down Expand Up @@ -936,7 +936,7 @@ Example:
Expected Result:

.A window showing the custom properties you have defined is opened
image::ViewCustom.png[align="center", width=85%, scaledwidth=15cm]
image::ViewCustom.png[align="center", width=400]

=== Exiting the program : `exit`

Expand Down
Binary file modified docs/images/AddCustomRating.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/images/BenchPressRatingRemoved.png
Binary file not shown.
Binary file modified docs/images/CustomRating.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/DancingRatingRemoved.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/EditAnotherCustomRating.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/EditCustomRating.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/RatingRemainedForSeven.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/RatingRemovedForSix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/images/RunRatingRemoved.png
Binary file not shown.
Binary file added docs/images/RunningRatingRemoved.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public class AddExerciseCommand extends AddCommand implements PayloadCarrierComm
+ PREFIX_QUANTITY + "QUANTITY "
+ PREFIX_UNIT + "UNITS "
+ "[" + PREFIX_MUSCLE + "MUSCLE]..."
+ "\tExample: " + COMMAND_WORD + " "
+ "[CUSTOM_PROPERTY_PREFIX_NAME/VALUE]..."
+ "\nExample: " + COMMAND_WORD + " "
+ PREFIX_CATEGORY + "exercise "
+ PREFIX_NAME + "Run "
+ PREFIX_DATE + "22/09/2019 "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static java.util.Objects.requireNonNull;
import static seedu.exercise.commons.util.CollectionUtil.requireAllNonNull;
import static seedu.exercise.logic.parser.CliSyntax.PREFIX_INDEX;
import static seedu.exercise.logic.parser.CliSyntax.PREFIX_REMOVE_CUSTOM;

import java.util.List;
Expand Down Expand Up @@ -29,7 +30,8 @@
public class CustomRemoveCommand extends CustomCommand {

public static final String MESSAGE_USAGE_CUSTOM_REMOVE = "Parameters: "
+ PREFIX_REMOVE_CUSTOM + "FULL NAME\t"
+ PREFIX_REMOVE_CUSTOM + "FULL NAME"
+ " [" + PREFIX_INDEX + "INDEX" + "]\t"
+ "Example: " + COMMAND_WORD + " "
+ PREFIX_REMOVE_CUSTOM + "Rating ";

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/seedu/exercise/logic/commands/EditCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public class EditCommand extends Command implements UndoableCommand, PayloadCarr
+ "[" + PREFIX_CALORIES + "CALORIES] "
+ "[" + PREFIX_QUANTITY + "QUANTITY] "
+ "[" + PREFIX_UNIT + "UNIT] "
+ "[" + PREFIX_MUSCLE + "MUSCLE]...\t"
+ "[" + PREFIX_MUSCLE + "MUSCLE]..."
+ "[CUSTOM_PROPERTY_PREFIX_NAME/VALUE]...\n"
+ "Example: " + COMMAND_WORD + " "
+ PREFIX_INDEX + "1 "
+ PREFIX_DATE + "03/10/2019 "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static java.util.Objects.requireNonNull;
import static seedu.exercise.commons.core.ValidationRegex.ONLY_ALPHABETS_AND_SPACE;
import static seedu.exercise.commons.core.ValidationRegex.ONLY_NON_NEGATIVE_NUMBERS;
import static seedu.exercise.commons.core.ValidationRegex.ONLY_NON_NEGATIVE_INTEGER;

/**
* Encapsulates the different parameter types that a custom property can take in.
Expand All @@ -14,8 +14,10 @@ public enum ParameterType {

public static final String PARAMETER_CONSTRAINTS = "Parameter types should be one of the following: Number, "
+ "Date or Text";
public static final String TEXT_CONSTRAINTS = "Text should contain only alphabets and should not be blank.";
public static final String NUMBER_CONSTRAINTS = "Number should contain only numbers and should not be blank.";
public static final String TEXT_CONSTRAINTS = "Text should contain only alphabets and spaces and "
+ "should not be blank.";
public static final String NUMBER_CONSTRAINTS = "Number should be a non-negative integer and should not "
+ "be blank.";
private final String parameterName;

ParameterType(String parameterName) {
Expand Down Expand Up @@ -54,7 +56,7 @@ public static boolean isValidText(String value) {
* @return true if and only if the given value is a valid number
*/
public static boolean isValidNumber(String value) {
return value.matches(ONLY_NON_NEGATIVE_NUMBERS);
return value.matches(ONLY_NON_NEGATIVE_INTEGER);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public void isValidText() {

// Valid text -> return true
assertTrue(ParameterType.isValidText("This is a very long sentence which should be accepted"));
assertTrue(ParameterType.isValidText(" "));
assertTrue(ParameterType.isValidText("a"));
}

Expand All @@ -48,9 +47,9 @@ public void isValidNumber() {
assertFalse(ParameterType.isValidNumber("-3.4")); // No negative numbers allowed
assertFalse(ParameterType.isValidNumber("30/09/2019")); // Contains punctuation
assertFalse(ParameterType.isValidNumber("Only alphabets")); // Only letters
assertFalse(ParameterType.isValidNumber("3.141592654")); // Floating point number not allowed

// Valid number -> return true
assertTrue(ParameterType.isValidNumber("3.141592654")); // Floating point number allowed
assertTrue(ParameterType.isValidNumber("3")); // Integers allowed
assertTrue(ParameterType.isValidNumber("0")); // 0 allowed
assertTrue(ParameterType.isValidNumber("929481290194910942091")); // Large number
Expand Down

0 comments on commit ca5c741

Please sign in to comment.