Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…oject-32-things-to-do into feature-6-updates
  • Loading branch information
TiareMar committed Dec 5, 2022
2 parents 3264cb9 + 2f80613 commit ca0c833
Show file tree
Hide file tree
Showing 37 changed files with 1,451 additions and 295 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,18 @@ _Not yet implemented (extending on what is currently working in the MVP feature)
If the user clicks on the `Scheduling CT` button, the screen to schedule a collaborative task will be displayed.
On this screen, the user can schedule a collaborative task.

To schedule a collaborative task, the user must input the name of the task, as well as the time block (start time and end time) in the format YYYY-MM-dd HH:mm.
Then the user must click on the `Submit` button to schedule the collaborative task.
![](images/scheduling_ct.png)

To schedule a collaborative task, the user must input the name of the task, as well as the time block
(start time and end time) in the format yyyy-MM-dd hh:mm.
Then the user must click on the `Schedule` button to schedule the collaborative task.
Only the leader/creator of the collaborative task is able to schedule it.
Depending on what the user chose frequency and deadline to be, the dates scheduled will differ.

If there is a conflict with the inputted time block, a screen will pop up that says there is a conflict.
It is on the user to either communicate with their group about this conflict or to try and reschedule another time.
If there is no conflict, the dates and times will be scheduled and the program will return the successful input.
If there is no conflict, the dates and times will be displayed to the user, and it is on the user to communicate these
dates to their group.

## Progress Tracker

Expand Down
9 changes: 2 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
plugins {
id 'groovy'
id 'java'
}

Expand All @@ -8,10 +7,8 @@ repositories {
}

dependencies {
implementation 'junit:junit:4.13.2'
//testImplementation('org.junit.jupiter:junit-jupiter:5.9.0')
testImplementation(enforcedPlatform('org.junit:junit-bom:5.9.0')) // JUnit 5 BOM
testImplementation("org.junit.jupiter:junit-jupiter")
implementation 'junit:junit:4.13.1'
testImplementation('org.junit.jupiter:junit-jupiter:5.6.0')
}

test {
Expand All @@ -20,5 +17,3 @@ test {
events "passed", "skipped", "failed"
}
}

ext['junit-jupiter.version'] = '5.9.0'
Binary file added images/scheduling_ct.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 17 additions & 6 deletions src/main/java/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
import use_cases.login_registration.login_usecase.LoginInputBoundary;
import use_cases.login_registration.login_usecase.LoginInteractor;
import use_cases.login_registration.login_usecase.LoginPresenter;
import use_cases.login_registration.logout_usecase.LogoutGateway;
import use_cases.login_registration.logout_usecase.LogoutInputBoundary;
import use_cases.login_registration.logout_usecase.LogoutInteractor;
import use_cases.login_registration.logout_usecase.LogoutPresenter;
import use_cases.login_registration.user_register_usecase.*;
import screens.task_management.FileTaskMap;

Expand Down Expand Up @@ -84,10 +88,10 @@ public static void main(String[] args) throws IOException, ClassNotFoundExceptio
GradeCalculatorInputBoundary gradeInteractor = new GradeCalculatorInteractor(gradePresenter, courseAccess);
GradeCalculatorController gradeController = new GradeCalculatorController(gradeInteractor);

ScheduleCTViewInterface presentOutputInterface = new ScheduleCTView(cardLayout, screens);
ScheduleCTOutputBoundary scheduleCTOutputBoundary = new ScheduleCTPresenter(presentOutputInterface);
ScheduleCTInputBoundary scheduleCTInputBoundary = new ScheduleCTInteractor(scheduleCTOutputBoundary);
ScheduleCTController scheduleCTController = new ScheduleCTController(scheduleCTInputBoundary, TaskMap.getTaskMap(), (StudentUser) user);
ScheduleCTViewInterface scheduleCTOutputView = new ScheduleCTView(cardLayout, screens);
ScheduleCTOutputBoundary scheduleCTPresenter = new ScheduleCTPresenter(scheduleCTOutputView);
ScheduleCTInputBoundary scheduleCTInteractor = new ScheduleCTInteractor(scheduleCTPresenter);
ScheduleCTController scheduleCTController = new ScheduleCTController(scheduleCTInteractor);

// Adding in course creation use case
CourseCreationDsGateway courseCreate = new FileCourse("src/main/java/data/courses.ser");
Expand All @@ -102,6 +106,12 @@ public static void main(String[] args) throws IOException, ClassNotFoundExceptio
CourseEnrolmentInputBoundary enrolmentInteractor = new CourseEnrolmentInteractor(enrolCourse, tasksToTodolist, enrolmentPresenter);
CourseEnrolmentController enrolmentController = new CourseEnrolmentController(enrolmentInteractor);

// Adding in logout use case
LogoutGateway logoutUser = new FileUser("src/main/java/data/users.ser");
LogoutInputBoundary logoutInteractor = new LogoutInteractor(logoutUser);
LogoutController logoutController = new LogoutController(logoutInteractor);
//

// Build the GUI
StudentChooseTaskCreateScreen chooseStudentTask = new StudentChooseTaskCreateScreen(schedulerPresenter, scheduleConflictPresenter,
screens, cardLayout);
Expand All @@ -115,6 +125,7 @@ public static void main(String[] args) throws IOException, ClassNotFoundExceptio

ScheduleCTScreen scheduleCTScreen = new ScheduleCTScreen(scheduleCTController, screens, cardLayout);
screens.add("scheduleCT", scheduleCTScreen);
screens.add("scheduleCTView", (Component) scheduleCTOutputView);

progressTrackerScreen.setProgressTrackerController(trackerController);
progressTrackerScreen.setGradeCalculatorController(gradeController);
Expand All @@ -126,7 +137,7 @@ public static void main(String[] args) throws IOException, ClassNotFoundExceptio
CourseEnrolmentScreen courseEnrolmentScreen = new CourseEnrolmentScreen(enrolmentController, screens, cardLayout);
screens.add("courseEnrol", courseEnrolmentScreen);

StudentMainScreen studentMainScreen = new StudentMainScreen((StudentUser)user, screens, cardLayout);
StudentMainScreen studentMainScreen = new StudentMainScreen(screens, cardLayout, logoutController);
screens.add("StudentMain", studentMainScreen);

RegisterScreen registerScreen = new RegisterScreen(userRegisterController, cardLayout, screens);
Expand All @@ -135,7 +146,7 @@ public static void main(String[] args) throws IOException, ClassNotFoundExceptio
LoginScreen loginScreen = new LoginScreen(loginController, cardLayout, screens);
screens.add("login", loginScreen);

InstructorMainScreen instructorMainScreen = new InstructorMainScreen(screens, cardLayout);
InstructorMainScreen instructorMainScreen = new InstructorMainScreen(screens, cardLayout, logoutController);
screens.add("InstructorMain", instructorMainScreen);

WelcomeScreen welcomeScreen = new WelcomeScreen(cardLayout, screens);
Expand Down
Binary file removed src/main/java/data/TaskMap
Binary file not shown.
1 change: 1 addition & 0 deletions src/main/java/data/courses.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
course_name,course_instructor,tasks?
File renamed without changes.
Binary file added src/main/java/data/users.ser
Binary file not shown.
29 changes: 21 additions & 8 deletions src/main/java/screens/InstructorMainScreen.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
package screens;

import screens.login_registration.LoginFailed;
import screens.login_registration.LogoutController;
import screens.login_registration.LogoutFailed;
import use_cases.login_registration.login_usecase.LoginResponseModel;
import use_cases.login_registration.logout_usecase.LogoutResponseModel;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import static javax.swing.JOptionPane.showMessageDialog;

public class InstructorMainScreen extends JPanel implements ActionListener {


Expand All @@ -24,13 +32,16 @@ public class InstructorMainScreen extends JPanel implements ActionListener {
CardLayout cardLayout;
JPanel screens;

LogoutController logoutController;

/**
* The window of the main screen with buttons connecting to each use case
*/
public InstructorMainScreen(JPanel screens, CardLayout cardLayout) {
public InstructorMainScreen(JPanel screens, CardLayout cardLayout, LogoutController controller) {

this.cardLayout = cardLayout;
this.screens = screens;
this.logoutController = controller;

// Create label for title of screen
JLabel title = new JLabel("32 Things To Do");
Expand All @@ -40,21 +51,18 @@ public InstructorMainScreen(JPanel screens, CardLayout cardLayout) {
taskCreate = new JButton("New Task");
calendar = new JButton("Calendar");
courses = new JButton("Courses");
// scheduleCT = new JButton("Schedule Collaborative Task");
logout = new JButton("Logout");

taskCreate.addActionListener(this);
calendar.addActionListener(this);
courses.addActionListener(this);
// scheduleCT.addActionListener(this);
logout.addActionListener(this);

// Create panel for buttons
JPanel buttons = new JPanel();
buttons.add(taskCreate);
buttons.add(calendar);
buttons.add(courses);
// buttons.add(scheduleCT);
buttons.add(logout);

// Add all components to the panel
Expand All @@ -77,11 +85,16 @@ public void actionPerformed(ActionEvent evt) {
if (evt.getSource() == courses) {
cardLayout.show(screens, "course");
}
// if (evt.getSource() == scheduleCT) {
// cardLayout.show(screens, "scheduleCT");
// }

if (evt.getSource() == logout) {
cardLayout.show(screens, "welcome");
try {
logoutController.create();
showMessageDialog(this, "Successfully logged out");
cardLayout.show(screens, "welcome");
} catch (Exception e) {
showMessageDialog(this, "Logout failed");
}

}

}
Expand Down
25 changes: 21 additions & 4 deletions src/main/java/screens/StudentMainScreen.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package screens;

import entities.StudentUser;
import screens.login_registration.LogoutController;
import screens.task_management.todolist_screens.ToDoListPresenter;
import screens.task_management.todolist_screens.ToDoListScreen;
import use_cases.task_management.todolist_use_case.ToDoListInteractor;
Expand All @@ -10,6 +10,8 @@
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import static javax.swing.JOptionPane.showMessageDialog;

public class StudentMainScreen extends JPanel implements ActionListener {

/**
Expand All @@ -22,22 +24,24 @@ public class StudentMainScreen extends JPanel implements ActionListener {
JButton courses;
JButton scheduleCT;

JButton logout;

/**
* Objects for connecting to the other screens
*/
CardLayout cardLayout;
JPanel screens;

StudentUser user;
LogoutController logoutController;

/**
* The window of the main screen with buttons connecting to each use case
*/
public StudentMainScreen(StudentUser user, JPanel screens, CardLayout cardLayout) {
public StudentMainScreen(JPanel screens, CardLayout cardLayout, LogoutController controller) {

this.user = user;
this.cardLayout = cardLayout;
this.screens = screens;
this.logoutController = controller;

// Create label for title of screen
JLabel title = new JLabel("32 Things To Do");
Expand All @@ -50,13 +54,15 @@ public StudentMainScreen(StudentUser user, JPanel screens, CardLayout cardLayout
progressTracker = new JButton("Progress Tracker");
courses = new JButton("Courses");
scheduleCT = new JButton("Schedule Collaborative Task");
logout = new JButton("Logout");

createTask.addActionListener(this);
todoList.addActionListener(this);
calendar.addActionListener(this);
progressTracker.addActionListener(this);
courses.addActionListener(this);
scheduleCT.addActionListener(this);
logout.addActionListener(this);

// Create panel for buttons
JPanel buttons = new JPanel();
Expand All @@ -66,6 +72,7 @@ public StudentMainScreen(StudentUser user, JPanel screens, CardLayout cardLayout
buttons.add(progressTracker);
buttons.add(courses);
buttons.add(scheduleCT);
buttons.add(logout);

// Add all components to the panel
this.add(title);
Expand Down Expand Up @@ -103,5 +110,15 @@ public void actionPerformed(ActionEvent evt) {
if (evt.getSource() == scheduleCT) {
cardLayout.show(screens, "scheduleCT");
}
if (evt.getSource() == logout) {
try {
logoutController.create();
showMessageDialog(this, "Successfully logged out");
cardLayout.show(screens, "welcome");
} catch (Exception e) {
showMessageDialog(this, "Logout failed");
}
}

}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package screens.collaborative_task_scheduling;
import entities.StudentUser;
import entities.Task;

import use_cases.collaborative_task_scheduling.scheduling_ct_use_case.ScheduleCTInputBoundary;
import use_cases.collaborative_task_scheduling.scheduling_ct_use_case.ScheduleCTRequestModel;
import use_cases.collaborative_task_scheduling.scheduling_ct_use_case.ScheduleCTResponseModel;

import java.util.HashMap;

/**
* Controller for the Scheduling Collaborative Tasks Use Case
Expand All @@ -16,33 +13,24 @@ public class ScheduleCTController {

final ScheduleCTInputBoundary scheduleInput;

private final HashMap<String, Task> hashMap;

private final StudentUser studentUser;

/**
* Constructor for ScheduleCTController
* @param scheduleInput - the scheduleCTInputBoundary
* @param hashMap - a hash map of all task ids mapped to the task object
* @param studentUser - the current student user logged in
*/
public ScheduleCTController(ScheduleCTInputBoundary scheduleInput, HashMap<String, Task> hashMap, StudentUser studentUser) {
public ScheduleCTController(ScheduleCTInputBoundary scheduleInput) {
this.scheduleInput = scheduleInput;
this.hashMap = hashMap;
this.studentUser = studentUser;
}

/**
* Bundles information given by user as well as ScheduleCTController instance variables into a
* ScheduleCTRequestModel, scheduling that input
* @param taskName - the string title/name of the task
*
* @param taskName - the string title/name of the task
* @param startTime - the string representation of the start date and time the user wants to schedule
* @param endTime - the string representation of the end date and time the user wants to schedule
* @return a scheduleCTResponseModel
* @param endTime - the string representation of the end date and time the user wants to schedule
*/
public ScheduleCTResponseModel isConflict(String taskName, String startTime, String endTime) {
ScheduleCTRequestModel inputData = new ScheduleCTRequestModel(taskName, startTime, endTime, studentUser);
return scheduleInput.schedule(inputData, this.hashMap);
public void isConflict(String taskName, String startTime, String endTime) {
ScheduleCTRequestModel inputData = new ScheduleCTRequestModel(taskName, startTime, endTime);
scheduleInput.schedule(inputData);
}

}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import use_cases.collaborative_task_scheduling.scheduling_ct_use_case.ScheduleCTOutputBoundary;
import use_cases.collaborative_task_scheduling.scheduling_ct_use_case.ScheduleCTResponseModel;

import java.util.ArrayList;

/**
* Presenter for the Collaborative Scheduling Use Case
Expand All @@ -25,14 +24,9 @@ public ScheduleCTPresenter(ScheduleCTViewInterface scheduleCTViewInterface) {
@Override
public ScheduleCTResponseModel prepareNoConflictView(ScheduleCTResponseModel responseModel) {

ArrayList<String> availableDates = responseModel.getScheduledTimes();
scheduleCTViewInterface.present(responseModel);

// making an instance of a class between presenter and view that can communicate information
ScheduleCTFormatter scheduleCTFormatter = new ScheduleCTFormatter(availableDates);

scheduleCTViewInterface.present(scheduleCTFormatter);

return responseModel;
return null;
}

/**
Expand All @@ -44,4 +38,4 @@ public ScheduleCTResponseModel prepareNoConflictView(ScheduleCTResponseModel res
public ScheduleCTResponseModel prepareFailView(String error) {
throw new SchedulingTimesFailed(error);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public void actionPerformed(ActionEvent evt) {
} else if (evt.getActionCommand().equals("Schedule")) {
try {
scheduleCTController.isConflict(taskTitle.getText(), startTime.getText(), endTime.getText());
screenLayout.show(screens, "scheduleCTView");
} catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
}
Expand Down
Loading

0 comments on commit ca0c833

Please sign in to comment.