Skip to content
Snippets Groups Projects
Commit df9f3ebf authored by eyan_'s avatar eyan_
Browse files

Merge remote-tracking branch 'origin/main' into main

parents d7dd8f45 ab3e1970
No related branches found
No related tags found
No related merge requests found
package com.example.schedulerapp; package com.example.schedulerapp;
import java.lang.reflect.Array;
import java.net.*; import java.net.*;
import java.io.*; import java.io.*;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -31,14 +32,20 @@ public class ScheduleClient { ...@@ -31,14 +32,20 @@ public class ScheduleClient {
} }
} }
void getAllShifts(){ //todo
writer.println("allEmployees"); //Return
void getAllEmployees() {
} }
void getAllEmployees(){ void updateAllShifts(){
writer.println("allShifts"); writer.println("allShifts");
} }
void updateAllEmployees(){
writer.println("allEmployees");
}
void addEmployee(String first_name, String last_name) { void addEmployee(String first_name, String last_name) {
writer.println("addEmployee/" + first_name + "/" + last_name); writer.println("addEmployee/" + first_name + "/" + last_name);
} }
...@@ -83,9 +90,37 @@ public class ScheduleClient { ...@@ -83,9 +90,37 @@ public class ScheduleClient {
System.out.println(this.shifts); System.out.println(this.shifts);
} }
//todo /*
String getShiftsByWeek(){ Parameters:
return "Need to implement"; startOfWeek - The first day of the week in "yyyy-mm-dd" format
endOfWeek - The last day of the week in "yyyy-mm-dd" format
Return: ArrayList<String>
*/
ArrayList<String> getShiftsByWeek(String startOfWeek, String endOfWeek){
String[] startSplit = startOfWeek.split("-");
String[] endSplit = endOfWeek.split("-");
ArrayList<String> output = new ArrayList<>();
for(String shift: this.shifts){
if(!shift.equals("allShifts")){
String[] shiftSplit = shift.split("\\.");
String[] dateSplit = shiftSplit[1].split("-");
try {
if(Integer.parseInt(startSplit[0]) >= Integer.parseInt(dateSplit[0]) &&
Integer.parseInt(startSplit[1]) >= Integer.parseInt(dateSplit[1]) &&
Integer.parseInt(startSplit[2]) >= Integer.parseInt(dateSplit[2])){
if(Integer.parseInt(endSplit[0]) >= Integer.parseInt(dateSplit[0]) &&
Integer.parseInt(endSplit[1]) >= Integer.parseInt(dateSplit[1]) &&
Integer.parseInt(endSplit[2]) >= Integer.parseInt(dateSplit[2])){
output.add(shift);
}
}
} catch (Exception e){
System.out.println("Error: Parsing string to int");
}
}
}
return output;
} }
//todo //todo
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment