Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
deep-mm committed Nov 10, 2022
1 parent e8a9dde commit 2156945
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ <h2>Add Employee</h2>
<div style="margin-top: 10px;">
<mat-label>Role</mat-label><br>
<mat-select [(ngModel)]="employee.role" name="role">
<mat-option *ngFor="let role of roles" [value]="roles.indexOf(role)">
<mat-option *ngFor="let role of roles" [value]="roles.indexOf(role)+2">
{{role}}
</mat-option>
</mat-select>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,12 @@ public ServiceEvent getServiceEventByName(@PathVariable int service_id) {
public Integer getAvailableMechanic(@PathVariable int service_center_id,
@RequestParam(value = "date", defaultValue = "") String date) {

String sql = "SELECT UNIQUE SE.MECHANIC_ID FROM SERVICE_EVENT SE WHERE SE.service_center_id = "
+ service_center_id + " AND NOT EXISTS (SELECT * FROM SERVICE_EVENT SE1 WHERE SE1.mechanic_id = SE.mechanic_id AND SE1.service_center_id = SE.service_center_id AND trunc(SE1.START_TIME) = TO_DATE('"
String sql = "SELECT UNIQUE E.EMPLOYEE_ID FROM EMPLOYEE E WHERE E.service_center_id = "
+ service_center_id
+ " AND E.role = 3 AND NOT EXISTS (SELECT * FROM SERVICE_EVENT SE1 WHERE SE1.mechanic_id = E.EMPLOYEE_ID AND SE1.service_center_id = E.service_center_id AND trunc(SE1.START_TIME) = TO_DATE('"
+ date + "', 'YYYY-MM-DD')) AND NOT EXISTS (SELECT * FROM LEAVE L WHERE TO_DATE('"
+ date + "', 'YYYY-MM-DD') BETWEEN trunc(L.START_DATE) AND trunc(L.END_DATE) AND L.employee_id = SE.mechanic_id AND L.service_center_id = SE.service_center_id AND L.status = 1)";
+ date
+ "', 'YYYY-MM-DD') BETWEEN trunc(L.START_DATE) AND trunc(L.END_DATE) AND L.employee_id = E.employee_id AND L.service_center_id = E.service_center_id AND L.status = 1)";

List<Integer> mechanics = jdbcTemplate.queryForList(
sql,
Expand Down

0 comments on commit 2156945

Please sign in to comment.