-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from CSC207-2022F-UofT/feature-6-updates
Feature 6 updates
- Loading branch information
Showing
30 changed files
with
1,379 additions
and
426 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 0 additions & 44 deletions
44
src/main/java/screens/course_progress/ProgressTrackerController.java
This file was deleted.
Oops, something went wrong.
46 changes: 0 additions & 46 deletions
46
src/main/java/screens/course_progress/ProgressTrackerPresenter.java
This file was deleted.
Oops, something went wrong.
96 changes: 0 additions & 96 deletions
96
src/main/java/screens/course_progress/ProgressTrackerScreen.java
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
src/main/java/screens/course_tracker/GradeCalculatorController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package screens.course_tracker; | ||
|
||
import use_cases.course_tracker.grade_calculator_use_case.GradeCalculatorInputBoundary; | ||
import use_cases.course_tracker.grade_calculator_use_case.GradeCalculatorRequestModel; | ||
|
||
import java.util.ArrayList; | ||
|
||
/** | ||
* Controller for the Grade Calculator Use Case | ||
* Located in the presenter/controller layer | ||
*/ | ||
public class GradeCalculatorController { | ||
|
||
final GradeCalculatorInputBoundary gradeCalculatorInteractor; | ||
|
||
public GradeCalculatorController(GradeCalculatorInputBoundary gradeCalculatorInteractor) { | ||
this.gradeCalculatorInteractor = gradeCalculatorInteractor; | ||
} | ||
|
||
void calculateGrade(String courseName, String userInput, ArrayList<String> ungradedTasks) { | ||
|
||
GradeCalculatorRequestModel requestModel = new GradeCalculatorRequestModel(courseName, userInput, | ||
ungradedTasks); | ||
|
||
gradeCalculatorInteractor.calculateGrade(requestModel); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/screens/course_tracker/GradeCalculatorPresenter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package screens.course_tracker; | ||
|
||
import use_cases.course_tracker.grade_calculator_use_case.GradeCalculatorOutputBoundary; | ||
import use_cases.course_tracker.grade_calculator_use_case.GradeCalculatorResponseModel; | ||
|
||
|
||
/** | ||
* Presenter for the Grade Calculator use case | ||
* Located in the presenter/controller layer | ||
*/ | ||
public class GradeCalculatorPresenter implements GradeCalculatorOutputBoundary { | ||
|
||
private final GradeCalculatorViewBoundary screen; | ||
|
||
public GradeCalculatorPresenter(GradeCalculatorViewBoundary screen) { | ||
this.screen = screen; | ||
} | ||
|
||
@Override | ||
public GradeCalculatorResponseModel display(GradeCalculatorResponseModel responseModel) { | ||
String displayString = "Get an average of " + responseModel.getRequiredGrade() + "% in target tasks."; | ||
|
||
GradeCalculatorViewModel viewModel = new GradeCalculatorViewModel(displayString); | ||
|
||
screen.showRequiredGrade(viewModel); | ||
return responseModel; | ||
} | ||
|
||
@Override | ||
public GradeCalculatorResponseModel failView(String error) { | ||
throw new ProgressTrackingFail(error); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/screens/course_tracker/GradeCalculatorViewBoundary.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package screens.course_tracker; | ||
|
||
/** | ||
* View Boundary for the Grade Calculator use case | ||
* Located in the presenter/controller layer, used to invert the dependency between the view and presenter | ||
*/ | ||
public interface GradeCalculatorViewBoundary { | ||
void showRequiredGrade(GradeCalculatorViewModel viewModel); | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/screens/course_tracker/GradeCalculatorViewModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package screens.course_tracker; | ||
|
||
/** | ||
* View data object for the GradeCalculator use case | ||
* Located in the presenter/controller layer, used in the dependency inversion between view and presenter | ||
*/ | ||
public class GradeCalculatorViewModel { | ||
private final String displayMessage; | ||
|
||
public GradeCalculatorViewModel(String displayMessage) { | ||
this.displayMessage = displayMessage; | ||
} | ||
|
||
public String getDisplayMessage() { | ||
return displayMessage; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/screens/course_tracker/ProgressTrackerController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package screens.course_tracker; | ||
|
||
import use_cases.course_tracker.progress_tracker_use_case.ProgressTrackerInputBoundary; | ||
import use_cases.course_tracker.progress_tracker_use_case.ProgressTrackerRequestModel; | ||
|
||
/** | ||
* Controller for the Progress Tracker Use Case | ||
* Located in the Interface Adapter Layer, triggers the Interactor | ||
*/ | ||
public class ProgressTrackerController { | ||
|
||
final ProgressTrackerInputBoundary progressInput; | ||
|
||
public ProgressTrackerController(ProgressTrackerInputBoundary progressInput) { | ||
this.progressInput = progressInput; | ||
} | ||
|
||
void trackProgress(String courseName, String newGradeTaskName, String newGrade, | ||
String newGoalGrade) { | ||
ProgressTrackerRequestModel requestModel = new ProgressTrackerRequestModel(courseName, | ||
newGradeTaskName, newGrade, newGoalGrade); | ||
|
||
progressInput.trackProgress(requestModel); | ||
} | ||
} |
Oops, something went wrong.