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 interface and abstract class viewmodel #38

Closed
wants to merge 13 commits into from

Conversation

Yuhan-Ut
Copy link
Contributor

make an abstract class for Viewmodel, so the update interface (and it's abstract method)can accept all viewmodel, but not only bill_update
also, sorted usecases files under the package called usecases

ScottCTD and others added 12 commits October 24, 2022 21:41
…se those instance to generate User/dummyuser in getuser function

[*]Modify Iuser, so this interface include abstract functions supposed to return instance of user and dummyuser,(may add more function later)

[+]Add constructor for Userfactory

[+]Add quickGetUser in Userfactory, using default value stored to create desired type User

[*]cleaning up some Redundant code in UserFactory
# Conflicts:
#	src/main/java/billgates/entities/AbstractEntry.java
#	src/main/java/billgates/entities/Attribute.java
#	src/main/java/billgates/entities/DummyUser.java
#	src/main/java/billgates/entities/Entry.java
#	src/main/java/billgates/entities/User.java
[-]remove userfactor
[+]todo a alterentry demo test
[?]discuss about alterdemo later
… convenience

[+]add abstract class Viewmodel that all viewmodel extends for
[-]remove Updatable_alter.java
[*]Modify Updatable interface so it accept all Viewmodel but not only bill_viewmodel
do not need this anymore
@Yuhan-Ut Yuhan-Ut changed the title [*]update [*]update interface and abstract class viewmodel Nov 18, 2022
Copy link
Contributor

@Yunshan-522 Yunshan-522 left a comment

Choose a reason for hiding this comment

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

I think it's a great job, especially the idea of linking all viewmodel is excellent! However, I think some functions should be named alter() or alterEntry(). Since these functions all alter the entry, maybe it would be easier to understand if they were renamed alter or alterEntry.



public interface AlterEntryOutputPort {
void updateBill(AlterEntryResponseModel model);
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this should be: viod alterEntry(AlterEntryResponseModel model);

this.useCase = useCase;
}

public void update(int billId, QueryEntryData entry) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this should be: public viod alter(int billId, QueryEntryData entry) {

}

@Override
public void updateBill(AlterEntryResponseModel model) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this should be: public void alterEntry(AlterEntryResponseModel model) {

List<List<Object>> entries = model.getEntries();
// TODO: We should format the column in a more intuitive way.
AlterEntryViewModel viewModel = new AlterEntryViewModel(entries);
this.view.update(viewModel);
Copy link
Contributor

Choose a reason for hiding this comment

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

Same there: this.view.alter(viewModel);

List<Entry> result = this.gateway.getBillData(User.getInstance().getCurrentBillID()).getEntries()
.stream().map(d -> d.toEntryBuilder().build()).toList();
System.out.println(result); // TODO remove this
this.presenter.updateBill(new AlterEntryResponseModel(result.stream().map(Entry::toObjects).toList()));
Copy link
Contributor

Choose a reason for hiding this comment

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

Same there: this.presenter.alterEntry(

@xgao28
Copy link
Contributor

xgao28 commented Nov 18, 2022

Also, this pull request consists of commits from others, so you may want to open another pull request.

@Yuhan-Ut
Copy link
Contributor Author

Also, this pull request consists of commits from others, so you may want to open another pull request.

Do you know how to avoid this? I did not noticed there are scott's commit here. How to start a pr that only my commit?

@xgao28
Copy link
Contributor

xgao28 commented Nov 18, 2022

Also, this pull request consists of commits from others, so you may want to open another pull request.

Do you know how to avoid this? I did not noticed there are scott's commit here. How to start a pr that only my commit?

Creating a new branch that's up-to-date, and coding in the new branch may work?

Moreover, there are two pull requests from one branch that states separate goals. It would be better to create a new branch for every single goal, and in this way, we can separate the [+] adding implementation from [*] modifying.

@Lei-Tin Lei-Tin changed the title [*]update interface and abstract class viewmodel [*] Update interface and abstract class viewmodel Nov 19, 2022
@Lei-Tin
Copy link
Collaborator

Lei-Tin commented Nov 19, 2022

I will not review this Pull Request at the moment, as it is not really urgent to be implemented. Furthermore, with Scott's ViewModel & Presenter Demo, I believe it is enough to test out these use cases.

Also, I believe by implementing the use cases first and completely, we can then decide on display and rendering issues later on.

But, nice start!

@Lei-Tin Lei-Tin added the enhancement New feature or request label Nov 19, 2022
@Lei-Tin Lei-Tin linked an issue Nov 19, 2022 that may be closed by this pull request
6 tasks
@ScottCTD ScottCTD closed this Nov 20, 2022
@xgao28
Copy link
Contributor

xgao28 commented Nov 21, 2022

I reviewed the general idea of this pull request.
Please refer my thoughts in this discussion. #37

@ScottCTD ScottCTD deleted the BR_fix_update branch November 22, 2022 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature 3] Implement Use Cases in our CRC Model.
5 participants