issue-32 #34
@ -6,8 +6,13 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Load worked minutes when reloading dashboard">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/core/api/controller/ScheduleController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/controller/ScheduleController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/core/repositories/timemanager/BasicTaskScheduleRepository.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/repositories/timemanager/BasicTaskScheduleRepository.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../frontend/src/app/dashboard/forgotten-task-start-dialog/forgotten-task-start-dialog.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/dashboard/forgotten-task-start-dialog/forgotten-task-start-dialog.component.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../frontend/src/api/api/schedule.service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/api/api/schedule.service.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../frontend/src/app/app.module.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/app.module.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../frontend/src/app/dashboard/dashboard.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/dashboard/dashboard.component.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../openapi.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../openapi.yaml" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -18,15 +23,15 @@
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Interface" />
|
||||
<option value="Class" />
|
||||
<option value="Enum" />
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
||||
<map>
|
||||
<entry key="$PROJECT_DIR$/.." value="issue-29" />
|
||||
<entry key="$PROJECT_DIR$/.." value="master" />
|
||||
</map>
|
||||
</option>
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
|
||||
@ -236,7 +241,15 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698512069065</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="17" />
|
||||
<task id="LOCAL-00017" summary="Work also with start schedule based on last minute">
|
||||
<option name="closed" value="true" />
|
||||
<created>1698569793571</created>
|
||||
<option name="number" value="00017" />
|
||||
<option name="presentableId" value="LOCAL-00017" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698569793571</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="18" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
|
@ -220,4 +220,15 @@ public class ScheduleController {
|
||||
return ResponseEntity.ok(new TaskScheduleStopResponse(serviceResult.getResult()));
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/schedules/missed")
|
||||
public ResponseEntity<?> loadMissedSchedules() {
|
||||
Optional<User> user = userRepository.findByUsername(SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if(user.isEmpty()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
List<BasicTaskSchedule> schedules = taskScheduleService.loadMissedSchedules(user.get());
|
||||
return ResponseEntity.ok(schedules.stream().map(ScheduleInfo::new).toList());
|
||||
}
|
||||
}
|
||||
|
@ -39,4 +39,7 @@ public interface BasicTaskScheduleRepository extends CrudRepository<BasicTaskSch
|
||||
|
||||
@Query(value = "SELECT bts FROM BasicTaskSchedule bts WHERE bts.task.taskgroup.user = ?1 AND bts.scheduleDate = ?2 AND bts.finishedTime IS NOT NULL")
|
||||
List<BasicTaskSchedule> findAllFinishedByUserAndDate(User user, LocalDate now);
|
||||
|
||||
@Query(value = "SELECT bts FROM BasicTaskSchedule bts WHERE bts.task.taskgroup.user = ?1 AND bts.startTime IS NULL AND bts.finishedTime IS NULL")
|
||||
List<BasicTaskSchedule> findAllUnstartedSchedulesOfUser(User user);
|
||||
}
|
||||
|
@ -213,4 +213,16 @@ public class TaskScheduleService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<BasicTaskSchedule> loadMissedSchedules(User user) {
|
||||
List<BasicTaskSchedule> unstartedSchedules = basicTaskScheduleRepository.findAllUnstartedSchedulesOfUser(user);
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
List<BasicTaskSchedule> missedSchedules = new LinkedList<>();
|
||||
for(BasicTaskSchedule schedule : unstartedSchedules) {
|
||||
if(schedule.getScheduleDate().isBefore(currentDate)) {
|
||||
missedSchedules.add(schedule);
|
||||
}
|
||||
}
|
||||
return missedSchedules;
|
||||
}
|
||||
}
|
||||
|
@ -202,6 +202,61 @@ export class ScheduleService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* registers forgotten schedule
|
||||
* Registers forgotten schedule
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public schedulesMissedGet(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<Array<ScheduleInfo>>;
|
||||
public schedulesMissedGet(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<Array<ScheduleInfo>>>;
|
||||
public schedulesMissedGet(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<Array<ScheduleInfo>>>;
|
||||
public schedulesMissedGet(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
let localVarCredential: string | undefined;
|
||||
// authentication (API_TOKEN) required
|
||||
localVarCredential = this.configuration.lookupCredential('API_TOKEN');
|
||||
if (localVarCredential) {
|
||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
||||
}
|
||||
|
||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
||||
if (localVarHttpContext === undefined) {
|
||||
localVarHttpContext = new HttpContext();
|
||||
}
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' = 'json';
|
||||
if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<Array<ScheduleInfo>>(`${this.configuration.basePath}/schedules/missed`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* activates schedule
|
||||
* activates schedule
|
||||
|
@ -69,6 +69,7 @@ import { TaskgroupOverviewComponent } from './dashboard/taskgroup-overview/taskg
|
||||
import { TaskOverviewComponent } from './dashboard/task-overview/task-overview.component';
|
||||
import { ForgottenTaskStartDialogComponent } from './dashboard/forgotten-task-start-dialog/forgotten-task-start-dialog.component';
|
||||
import {MatAutocompleteModule} from "@angular/material/autocomplete";
|
||||
import { MissedSchedulesComponent } from './missed-schedules/missed-schedules.component';
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
@ -100,7 +101,8 @@ import {MatAutocompleteModule} from "@angular/material/autocomplete";
|
||||
ActiveScheduleComponent,
|
||||
TaskgroupOverviewComponent,
|
||||
TaskOverviewComponent,
|
||||
ForgottenTaskStartDialogComponent
|
||||
ForgottenTaskStartDialogComponent,
|
||||
MissedSchedulesComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
@ -3,7 +3,7 @@
|
||||
<mat-card *ngIf="missedSchedules" class="red-card">
|
||||
<mat-card-content>
|
||||
<p>There are missed schedules. Please reschedule them.</p>
|
||||
<a class="btn-link" routerLink="/">Reschedule</a>
|
||||
<a class="btn-link" routerLink="/reschedule">Reschedule</a>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<h1 class="dashboard-heading">Now<b class="today-worked-info">Today: {{workedMinutesToday}} min</b></h1>
|
||||
|
30
openapi.yaml
30
openapi.yaml
@ -1694,9 +1694,30 @@ paths:
|
||||
schema:
|
||||
type: object
|
||||
$ref: "#/components/schemas/SimpleStatusResponse"
|
||||
|
||||
|
||||
|
||||
/schedules/missed:
|
||||
get:
|
||||
security:
|
||||
- API_TOKEN: []
|
||||
tags:
|
||||
- schedule
|
||||
description: Registers forgotten schedule
|
||||
summary: registers forgotten schedule
|
||||
responses:
|
||||
200:
|
||||
description: Operation successfull
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/ScheduleInfo'
|
||||
403:
|
||||
description: User not found/No permission
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/SimpleStatusResponse'
|
||||
|
||||
components:
|
||||
securitySchemes:
|
||||
API_TOKEN:
|
||||
@ -2231,4 +2252,5 @@ components:
|
||||
minutesSpent:
|
||||
type: number
|
||||
description: number of minutes spent on task
|
||||
example: 10
|
||||
example: 10
|
||||
|
Loading…
Reference in New Issue
Block a user