17 lines
727 B
PL/PgSQL
17 lines
727 B
PL/PgSQL
CREATE OR REPLACE PROCEDURE public."Hr_S_DevelopmentPlanSync"(
|
||
p_PlanId uuid
|
||
)
|
||
LANGUAGE plpgsql
|
||
AS $$
|
||
BEGIN
|
||
-- Eğitim aksiyonu, çalışan o eğitime "Katıldı" olarak işlendiyse kendiliğinden tamamlanır;
|
||
-- tamamlanan aksiyonun ilerlemesi her zaman %100'dür.
|
||
UPDATE "Hr_T_DevelopmentPlan" dp
|
||
SET "Status" = 'Completed', "Progress" = 100
|
||
WHERE dp."Id" = p_PlanId AND dp."IsDeleted" = FALSE AND dp."Status" <> 'Cancelled'
|
||
AND (dp."Status" = 'Completed' OR EXISTS (
|
||
SELECT 1 FROM "Hr_T_TrainingParticipant" tp
|
||
WHERE tp."TrainingId" = dp."TrainingId" AND tp."UserId" = dp."EmployeeId"
|
||
AND tp."AttendanceStatus" = 'Attended' AND tp."IsDeleted" = FALSE));
|
||
END
|
||
$$;
|