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

Fix link not reflected in add and edit commands #119

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static seedu.address.logic.parser.CliSyntax.PREFIX_DATE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_HEADLINE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_INTERVIEWEE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_LINK;
import static seedu.address.logic.parser.CliSyntax.PREFIX_OUTLET;
import static seedu.address.logic.parser.CliSyntax.PREFIX_STATUS;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;
Expand All @@ -31,19 +32,21 @@ public class AddArticleCommand extends ArticleCommand {
+ "Parameters: "
+ PREFIX_HEADLINE + "HEADLINE "
+ "[" + PREFIX_CONTRIBUTOR + "CONTRIBUTOR]... "
+ PREFIX_DATE + "DATE] "
+ "[" + PREFIX_INTERVIEWEE + "INTERVIEWEE]... "
+ "[" + PREFIX_TAG + "TAG]... "
+ "[" + PREFIX_OUTLET + "OUTLET]... "
+ PREFIX_STATUS + "STATUS\n"
+ "[" + PREFIX_DATE + "DATE] "
+ PREFIX_STATUS + "STATUS "
+ "[" + PREFIX_LINK + "LINK]\n"
+ "Example: " + COMMAND_WORD + " " + COMMAND_PREFIX + " "
+ PREFIX_HEADLINE + "The Great Article "
+ PREFIX_CONTRIBUTOR + "John Doe "
+ PREFIX_DATE + "2021-10-10 "
+ PREFIX_INTERVIEWEE + "Jane Doe "
+ PREFIX_TAG + "friends "
+ PREFIX_OUTLET + "The Great Outlet "
+ PREFIX_STATUS + "DRAFT";
+ PREFIX_DATE + "10-10-2024 "
+ PREFIX_STATUS + "DRAFT "
+ PREFIX_LINK + "https://www.example.com";

public static final String MESSAGE_SUCCESS = "New article added: %1$s";
public static final String MESSAGE_DUPLICATE_ARTICLE = "This article already exists in the article book";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static seedu.address.logic.parser.CliSyntax.PREFIX_DATE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_HEADLINE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_INTERVIEWEE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_LINK;
import static seedu.address.logic.parser.CliSyntax.PREFIX_OUTLET;
import static seedu.address.logic.parser.CliSyntax.PREFIX_STATUS;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;
Expand Down Expand Up @@ -51,19 +52,21 @@ public class EditArticleCommand extends ArticleCommand {
+ "Parameters: INDEX (must be a positive integer) "
+ "[" + PREFIX_HEADLINE + "HEADLINE] "
+ "[" + PREFIX_CONTRIBUTOR + "CONTRIBUTOR]... "
+ "[" + PREFIX_DATE + "DATE] "
+ "[" + PREFIX_INTERVIEWEE + "INTERVIEWEE]... "
+ "[" + PREFIX_TAG + "TAG]... "
+ "[" + PREFIX_OUTLET + "OUTLET]... "
+ "[" + PREFIX_STATUS + "STATUS]\n"
+ "[" + PREFIX_DATE + "DATE] "
+ "[" + PREFIX_STATUS + "STATUS] "
+ "[" + PREFIX_LINK + "LINK]\n"
+ "Example: " + COMMAND_WORD + " " + COMMAND_PREFIX + " 1 "
+ PREFIX_HEADLINE + "Headline "
+ PREFIX_CONTRIBUTOR + "Contributor(s) "
+ PREFIX_DATE + "2021-10-10 "
+ PREFIX_INTERVIEWEE + "Interviewee(s) "
+ PREFIX_TAG + "New Tag(s) "
+ PREFIX_OUTLET + "New Outlet(s) "
+ PREFIX_STATUS + "PUBLISHED";
+ PREFIX_DATE + "10-10-2024 "
+ PREFIX_STATUS + "PUBLISHED "
+ PREFIX_LINK + "https://www.example.com";

public static final String MESSAGE_EDIT_ARTICLE_SUCCESS = "Edited Article: %1$s";
public static final String MESSAGE_NOT_EDITED = "At least one field to edit must be provided.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import static seedu.address.logic.parser.CliSyntax.PREFIX_DATE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_HEADLINE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_INTERVIEWEE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_LINK;
import static seedu.address.logic.parser.CliSyntax.PREFIX_OUTLET;
import static seedu.address.logic.parser.CliSyntax.PREFIX_STATUS;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;
Expand Down Expand Up @@ -38,7 +39,7 @@
requireNonNull(args);
ArgumentMultimap argMultimap =
ArgumentTokenizer.tokenize(args, PREFIX_HEADLINE, PREFIX_CONTRIBUTOR, PREFIX_INTERVIEWEE,
PREFIX_TAG, PREFIX_OUTLET, PREFIX_DATE, PREFIX_STATUS);
PREFIX_TAG, PREFIX_OUTLET, PREFIX_DATE, PREFIX_STATUS, PREFIX_LINK);

Index index;

Expand All @@ -64,6 +65,9 @@
editArticleDescriptor.setStatus(ParserUtil.parseStatus(argMultimap.getValue(PREFIX_STATUS)
.get()));
}
if (argMultimap.getValue(PREFIX_LINK).isPresent()) {
editArticleDescriptor.setLink(ParserUtil.parseLink(argMultimap.getValue(PREFIX_LINK).get()));

Check warning on line 69 in src/main/java/seedu/address/logic/parser/EditArticleCommandParser.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/parser/EditArticleCommandParser.java#L69

Added line #L69 was not covered by tests
}

parseAuthorsForEdit(argMultimap.getAllValues(PREFIX_CONTRIBUTOR)).ifPresent(editArticleDescriptor::setAuthors);
parseSourcesForEdit(argMultimap.getAllValues(PREFIX_INTERVIEWEE)).ifPresent(editArticleDescriptor::setSources);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/seedu/address/ui/ArticleCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
});
} else {
hyperlink.setVisible(false);
hyperlink.setManaged(false);

Check warning on line 94 in src/main/java/seedu/address/ui/ArticleCard.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/ui/ArticleCard.java#L94

Added line #L94 was not covered by tests
}
}

Expand Down
Loading