Skip to content

Commit

Permalink
Merge pull request #73 from CSC207-2022F-UofT/Feature-5-small-edits
Browse files Browse the repository at this point in the history
Feature 5 - tests, functionality, readme
  • Loading branch information
alyson647 authored Dec 5, 2022
2 parents 055a04a + 55d6941 commit 2f80613
Show file tree
Hide file tree
Showing 21 changed files with 1,361 additions and 154 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
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.
9 changes: 5 additions & 4 deletions src/main/java/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ public static void main(String[] args) throws IOException, ClassNotFoundExceptio
ProgressTrackerInputBoundary trackerInteractor = new ProgressTrackerInteractor(trackerPresenter);
ProgressTrackerController trackerController = new ProgressTrackerController(trackerInteractor, user, "", TaskMap.getTaskMap(), allUsers, allCourses);

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 Down Expand Up @@ -116,6 +116,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 progressTrackerScreen = new ProgressTrackerScreen(trackerController);
screens.add("tracker", progressTrackerScreen);
Expand Down
Binary file removed src/main/java/data/TaskMap
Binary file not shown.
File renamed without changes.
Binary file added src/main/java/data/users.ser
Binary file not shown.
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package screens.collaborative_task_scheduling;

import use_cases.collaborative_task_scheduling.scheduling_ct_use_case.ScheduleCTResponseModel;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
Expand All @@ -26,20 +28,22 @@ public ScheduleCTView(CardLayout screenLayout, JPanel screens) {

/**
* Method implemented from PresentOutputInterface which presents the dates the user wishes to schedule
* @param scheduleCTFormatter - a ScheduleCTFormatter which stores the dates to present
* @param responseModel - a ScheduleCTResponseModel which stores the dates to present
*/
@Override
public void present(ScheduleCTFormatter scheduleCTFormatter) {
ArrayList<String> dateTimes = scheduleCTFormatter.getScheduledDateTimes();
public void present(ScheduleCTResponseModel responseModel) {
ArrayList<String> dateTimes = responseModel.getScheduledTimes();

JLabel title = new JLabel("Scheduled Times");
title.setAlignmentX(Component.CENTER_ALIGNMENT);

JPanel labels = new JPanel();
this.add(title);

for (String timeBlock : dateTimes) {
JPanel timeLabel = new JPanel();
JLabel time = new JLabel(timeBlock);
labels.add(time);
timeLabel.add(time);
this.add(timeLabel);
}

JPanel separateNote = new JPanel();
Expand All @@ -55,8 +59,6 @@ public void present(ScheduleCTFormatter scheduleCTFormatter) {

this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

this.add(title);
this.add(labels);
this.add(separateNote);
this.add(buttons);
}
Expand All @@ -68,4 +70,4 @@ public void actionPerformed(ActionEvent evt) {
JOptionPane.showMessageDialog(this, e.getMessage());
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package screens.collaborative_task_scheduling;
import use_cases.collaborative_task_scheduling.scheduling_ct_use_case.ScheduleCTResponseModel;


/**
Expand All @@ -9,7 +10,7 @@ public interface ScheduleCTViewInterface {

/**
* The method implemented in the view that prepares a screen showing the dates that were scheduled
* @param scheduleCTFormatter - a scheduleCTFormatter
* @param responseModel - a scheduleCTFormatter
*/
void present(ScheduleCTFormatter scheduleCTFormatter);
}
void present(ScheduleCTResponseModel responseModel);
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package use_cases.collaborative_task_scheduling.scheduling_ct_use_case;

import entities.Task;

import java.util.HashMap;

/**
* Input Boundary interface for the Scheduling Collaborative Tasks Use Case
Expand All @@ -14,8 +11,7 @@ public interface ScheduleCTInputBoundary {
/**
* The method implemented in ScheduleCTInteractor that schedules the task given the inputs
* @param scheduleCTRequestModel - the scheduleCTRequestModel (i.e. information given from the user)
* @param hashMap - hash map of task ids mapped to Task objects
* @return a scheduleCTResponseModel
*/
ScheduleCTResponseModel schedule(ScheduleCTRequestModel scheduleCTRequestModel, HashMap<String, Task> hashMap);
ScheduleCTResponseModel schedule(ScheduleCTRequestModel scheduleCTRequestModel);
}
Loading

0 comments on commit 2f80613

Please sign in to comment.