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

Update export command support #57

Merged

Conversation

JonathanLeeWH
Copy link

Rewrite CSV support Java Library to use Opencsv Java library instead of self coded library
Add Opencsv support
Add support batches to complement (PR #42 Commit: 5bf3653) and each batch of a particular medicine information has its own row in the csv file, this is to allow easier reference as each batch of the same medicine can have different expiry dates and different quantity depending on the batch
Refactor CsvWriter.java to CsvWrapper.java
pdate defaultHeading variable to support batch
Add isMedicineInitialised() method to CsvWrapper.java to support medicine batch
Add buildStringArray() method to CsvWrapper.java to support medicine batch
Add processMedicineData() method to CsvWrapper.java to support medicine batch
Note: The csv export implementation has been updated such that medicine that has been added but has no batch link to it will be ignored and not included in the compilation of the data for the csv file as the information would not be any useful information if it is added to the csv file as most of the fields would be empty as there are no data available (only the name and company would be available which is not very useful as there are no information such as the batch numbers, the quantity, etc)
This version also does not include JUnit tests as they will be included in future commits

Add CsvWriter.java and associated package in Storage package to provide CSV support and it will act as a library for Csv support which will be used by export command in the future
Update Exportcommand.java to implement export in csv file format support using the CsvWriter.java (self coded CSV support Java Library
This version creates a default "exported" directory and creates an empty csv file when export command is called
Note: This CSV support Java Library is created by me LEE WEI HAO JONATHAN (A0166980R)
Update CsvWriter.java to support the refactoring to MediTabs
Attempt to create own CSV Library with formatting based on RFC4180 (https://tools.ietf.org/html/rfc4180)
Note: There seem to be a minor formatting discrepencies in this version with regards to handling of the formatting of double quotes
I did many research and use many csv editor and online tools but there seem to be a little bug with regards to how to correctly format the double quotes. I will try to fix this is possible else the backup is to use opencsv which is accepted by CS2103T module lecturer
…ded library

Preparation for move to the use of Opencsv library instead of self coded library created in earlier commits due to current expertise not enough to solve the issue with regards to formatting of double quotations properly in csv file format after numerous testing with various csv file tools both online and also tools such as Microsoft excel and other excel similar applications
Delete CsvWriterTest.java which contain the JUnit test cases written for the self coded library in the earlier commits to prepare for the move to the use of Opencsv library
Add Opencsv library to build.gradle dependencies so as to include the necessary dependencies when building the project At the time of commit the opencsv library version 4.5 is used and included as a dependency
Update CsvWriter.java to support Opencsv library for exporting to csv file
Add initial support for Opencsv library in CsvWriter.java
Note: The Opencsv library is mainly used to solve the formatting bug which I faced when implementing my own self coded csv library, in other words, it is mainly used for formatting purposes
Refactor CsvWriter.java to CsvWrapper.java to avoid any potential conflicts with CSVWriter.java in Opencsv Java library
Update ExportCommand.java to support the refactoring of CsvWriter.java to CsvWrapper.java
…per.java in future commits

Update Medicine.java to add support for toStringArray() method which will be used by CsvWrapper.java in future commits
Add toFormattedDateString() method in Expiry.java to format the date to ensure the date is of the correct format
Remove toFormattedDateString() method in Expiry.java as it is already validated using regex
Add toStringUpperCase() method in Tag.java to support returning Tags in uppercase for use in future commits to prepare for export to csv file implementation
Update toStinrgArray() method in Medicine.java to improve support for export to csv file through better formatting of tag so it is easier for users to read the csv file exported and improve the formatting support for csv file format
…d in the GUI to csv file format

Update CsvWrapper.java to support exporting the current list displayed in the GUI to csv file format
Note: In this version, the csv file contains the current list displayed in the GUI when the export command is executed
I have personally tested manually to check for potential bugs and fixed some bugs I discovered as well during testing
JUnit test will be added in future release to better automate the testing process to ensure the export command works as expected
Add doCleanUp() method in CsvWrapper.java to clean up any empty csv file that is created when the export command is executed but displayed an exception such as CommandException due to possible invalid command
Update export() method in CsvWrapper.java to support the doCleanUp() method even it encounter a CommandException so as to clean up any empty csv file that is created when the export command is executed
This fix the bug where an empty csv file with default heading is still created despite the export command is unable to complete its execution due to a CommandException
Update README.adoc to include Opencsv Library as part of the libraries used
Resolve merge conflict in README.adoc
Update build.gradle to use implementation instead of compile when declaring dependencies as compile is depreciation and replace by implementation according to Gradle documentation https://docs.gradle.org/current/userguide/declaring_dependencies.html
Fix a bug where executing the export command with a filename that already exists as an argument does not display any exception in the CommandBox in the GUI
Update build.gradle to match coding standards
Update Medicine.java with delimiter variable to make the implementation of toStringArray() method clearer and more concise
Resolve merge conflict in Medicine.java to support the new update command feature
Update defaultHeading variable to support batch
Add isMedicineInitialised() method to CsvWrapper.java to support medicine batch
Add buildStringArray() method to CsvWrapper.java to support medicine batch
Add processMedicineData() method to CsvWrapper.java to support medicine batch
Note: The csv export implementation has been updated such that medicine that has been added but has no batch link to it will be ignored and not included in the compilation of the data for the csv file as the information would not be any useful information if it is added to the csv file as most of the fields would be empty as there are no data available (only the name and company would be available which is not very useful as there are no information such as the batch numbers, the quantity, etc)
This version also does not include JUnit tests as they will be included in future commits
@JonathanLeeWH JonathanLeeWH added the v1.2 For v1.2 project milestone label Mar 11, 2019
@JonathanLeeWH JonathanLeeWH added this to the v1.2 milestone Mar 11, 2019
@JonathanLeeWH JonathanLeeWH self-assigned this Mar 11, 2019
Copy link

@flxffy flxffy left a comment

Choose a reason for hiding this comment

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

Very comprehensive documentations and readable code. Great coding style

@flxffy flxffy merged commit 5cca4a8 into CS2103-AY1819S2-T12-3:master Mar 11, 2019
@JonathanLeeWH JonathanLeeWH deleted the update-export-command-support branch March 11, 2019 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v1.2 For v1.2 project milestone
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants