Closed qsjiang closed 9 years ago
Q: Hey Jim, thank you very much for breaking my code. Now what should I do?
A: You are welcome, here is what you need to do.
Claim claim = new Claim(name, sdate, edate,description, username);
ClaimListController.getClaimList().addClaim(claim);
ClaimListController.saveClaimList();
Simplely change to
claimListController.addClaim(name, sdate, edate,description, user);
...ClaimListController.getClaimList().getClaim(0)...
Use this instead
claimListController.getClaim(int id);
...ClaimListController.getClaimList().getClaim(id);...
Change to
claimListController.getClaim(id);
same as AddCommentsActivity.java
same as AddCommentsActivity.java
...ClaimListController.getClaimList().getSubmittedclaims()...
Change to
claimListController.filterByStatus(String "StatusHere")
...ClaimListController.getClaimList().addListener(....
Change to
claimListController.addListener(listener);
same as AddCommentsActivity.java
same as ApproverListActivity Line 50
ClaimListController.getClaimList().removeClaim(id);
Change to
claimListController.removeClaim(id);
ClaimListController.getClaimList().getClaim(0)
Change to
claimListController.getClaim(id)
same as ApproverListActivity Line 50
ClaimListController.getClaimList().getUserClaims(Username);
Change to
claimListController.filterByClaimant(user);
same as AddCommentsActivity.java
(Note: claimListController is an instance of ClaimListController, you only need to create one claimListController instance inside each of your activity. "ClaimListController claimListController = new ClaimListController();")
You're awesome! Thanks Jim, I shall do that tomorrow!
@LeahGabrielle , @megsum I've implemented all these changes, so that I could run the program without errors, just continue where you left off.
Is there anything for adding an expense item to a claim? Where would that be/how should I be accessing a function for that?
Hi Leah, They are not there at this moment. I'll add them in a few hours
@qsjiang @Pengwin-man @IchigoKIl Hey! I was just wondering if it would be possible to get a way in the ClaimListController to add tags for a specific claim. Thanks!
Hey @megsum, Just added two new functions into ClaimListController. (Details see commit 9829814769ba309f3e6e02ef432ac57bf7aedc6e)
public void addTagToClaim(int claimId, String tag);
public ArrayList<String> getTagListFromClaim(int claimId)
Right now we are using getting a claim and then calling claim.getTotal(); for the total, however even after making an exense item it always returns an empty list. Did you make another function we are supposed to be using? Or is the expense item not saving?
@vanbelle I will look into it, and let you know later tonight.
Another useful function would be an update function for the edit page. i.e: claim.updateClaim(string name, startdate, enddate, description, taglist, destinationlist) which keeps approver, claimant,id,comments etc. and uses set functions or something. might need notify listeners?
Hi @vanbelle thanks for the feedback,
There was a bug in the previous getTotal() function. It has been fixed in commit 9f45947713d97e3d28744e75891f4de37437c926
About adding functions into the ClaimListController: There are still a few things we need to discuss before nailing getTotal() and updateClaim() into our Stable APIs. For example, "uniqueness of expenseItem", "return object type of getTotal" and others...
We will discuss them next time we meet, for now just use the unstable version inside Claim class.
Hey guys,
Just pushed the first version of "ClaimListController API". Here are two most important points you need to know about the API.
Stable APIs:
All the functions under ClaimListController.java are considered as stable APIs, those functions will stays the same no matter how much the data models have changed. Use them when you need to retrieve/add/delete claims.
Unstable APIs:
All the functions under Claim.java and ClaimList.java are considered as unstable APIs, those functions are subject to change over times. Sometimes you might need to use them, but try to stick with the stable apis as much as possible.
Please post all the questions/problems regarding ClaimListController under this issue.