Skip to content

Commit

Permalink
Merge d20da40 into ac992e0
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammadaljunied committed Nov 11, 2019
2 parents ac992e0 + d20da40 commit 0ca11b3
Showing 1 changed file with 23 additions and 31 deletions.
54 changes: 23 additions & 31 deletions docs/team/muhammadaljunied.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,48 +30,40 @@ The fallback in poor/lack of internet conditions is a pre-loaded exchange rate s

* *Code contributed*: [https://nus-cs2103-ay1920s1.github.io/tp-dashboard/#search=aljunied&sort=groupTitle&sortWithin=title&since=2019-09-06&timeframe=commit&mergegroup=false&groupSelect=groupByRepos&breakdown=false&tabOpen=true&tabType=authorship&tabAuthor=muhammadaljunied&tabRepo=AY1920S1-CS2103-T14-4%2Fmain%5Bmaster%5D[Functional code]] [https://nus-cs2103-ay1920s1.github.io/tp-dashboard/#search=aljunied&sort=groupTitle&sortWithin=title&since=2019-09-06&timeframe=commit&mergegroup=false&groupSelect=groupByRepos&breakdown=false&tabOpen=true&tabType=authorship&tabAuthor=muhammadaljunied&tabRepo=AY1920S1-CS2103-T14-4%2Fmain%5Bmaster%5D[Test code]]

* *Other contributions*:

** Project management:
*** Managed releases `v1.3` - `v1.5rc` (3 releases) on GitHub
** Enhancements to existing features:
*** Updated the GUI color scheme (Pull requests https://github.com[#33], https://github.com[#34])
*** Wrote additional tests for existing features to increase coverage from 88% to 92% (Pull requests https://github.com[#36], https://github.com[#38])
** Documentation:
*** Did cosmetic tweaks to existing contents of the User Guide: https://github.com[#14]
** Community:
*** PRs reviewed (with non-trivial review comments): https://github.com[#12], https://github.com[#32], https://github.com[#19], https://github.com[#42]
*** Contributed to forum discussions (examples: https://github.com[1], https://github.com[2], https://github.com[3], https://github.com[4])
*** Reported bugs and suggestions for other teams in the class (examples: https://github.com[1], https://github.com[2], https://github.com[3])
*** Some parts of the history feature I added was adopted by several other class mates (https://github.com[1], https://github.com[2])
** Tools:
*** Integrated a third party library (Natty) to the project (https://github.com[#42])
*** Integrated a new Github plugin (CircleCI) to the team repo

_{you can add/remove categories in the list above}_

== Contributions to the User Guide

|===
|_Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users._
|===

include::../UserGuide.adoc[tag=delete]

include::../UserGuide.adoc[tag=dataencryption]
Initial format and structure of user guide together with all discussed User Stories

== Contributions to the Developer Guide

|===
|_Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project._
|===

include::../DeveloperGuide.adoc[tag=undoredo]
=== Currency Conversion
==== Implementation
The Currency conversion is achieved by having a default base currency that all expenses and budgets use if one is not specified. The expenses that are stored
with a different currency can be converted from the base currency and back. Every time a currency is specified, the present day exchange rate is stored with the expense. This
is to ensure that the expense value is timeless.

include::../DeveloperGuide.adoc[tag=dataencryption]
This was implemented in the `java.seedu.address.model.exchangedata` package, which contains `ExchangeDataSingleton`, `ExchangeData`, and `Rates`. These classes facilitate retrieval of exchange rates that will be requested from various parts of the app, namely `Expense` and `Budget`.

== PROJECT: PowerPointLabs
*Step 1*
The foreign currency exchange rates are downloaded for the app to use from http://exchangeratesapi.io/[ExchangeRatesAPI.io] using their endpoint `https://api.exchangeratesapi.io/latest?base=SGD`. The endpoint returns the data in JSON format, which works well with the existing JSON based storage used for `Expense` and `Budget`. This was implemented in the `java.seedu.address.commons.utils` package containing `HttpsClientUtil` which facilitates the Asynchronous calls to the endpoint to update the local copy of the foreign currency exchange rates upon app startup.

---
*Step 2*
The JSON response is persisted on disk. A default data-set of exchange rates will be generated at runtime (but not stored) in the case of unstable or no internet access if one is not yet present. If one was present however a more recent one could not be downloaded, the existing data will be reused.

*Step 3*
If the exchange data is present as a JSON, it will first be loaded into its JSON reflection class `JsonAdaptedExchangeData` which depends on `JsonAdaptedRates`. These classes assist in the conversions of the JSON to the Model Class `ExchangeData`.

Presently, ExchangeData is also stored in the StorageManager which was intended to be used to store multiple instances of ExchangeData to load historical exchange rates when the user does an edit, however this proved to be infeasible to implement within the course of the project.

*Step 4*
The `ExchangeDataSingleton` is updated with the new `ExchangeData` using the `ExchangeDataSingleton#updateInstance`. The reason for using the Singleton pattern in this case was to ensure that one and only one instance of `ExchangeData` is being referenced to retrieve data at any point in time. Since it is also required to be accessed by `Expense` and `Budget`.

*Step 5*
Conversions are done in `Expense#getConvertedAmount` for conversion back into the base currency (SGD) and `Expense#getConvertedAmount(Currency currency)` for conversions to any other currency. As most transactions in the app that require the conversion of currency involve an expense (including recomputing `amountLeft` of `Budget`), the computation is done in the expense. The following are the instance where the currency is converted:

_{Optionally, you may include other projects in your portfolio.}_
* Whenever an expense is displayed on the `ExpenseCard` or `CommandResult`, its converted value will be computed and displayed together with its conversion rate and original amount.

0 comments on commit 0ca11b3

Please sign in to comment.