CMDBuild Forum

BUG OPM2.0 : FUNCTION public.utils_wc_date_timeslots

Maybe a BUG in the utils_wc_date_timeslots so that to calculate the timeslots it’s ESSENTIAL setting days of the week in the WorkingCalendar.

	SELECT wc."TimeSlots"
	FROM "WorkingCalendar" wc
	LEFT JOIN "LookUp" priority ON priority."Id" = wc."Priority"
	WHERE (	(REPLACE(wc."CalendarDate", year_pattern, date_part('year', reference_ts)::varchar))::date = reference_ts::date --specific or recurrent day
		OR EXTRACT(DOW FROM reference_ts) = (SELECT "Notes"::integer FROM "LookUp" WHERE "Id" = wc."DayOfWeek") --corresponding weekday
	) AND wc."CalendarDef" = calendar_def AND wc."Status" = 'A'
	ORDER BY priority."Code"::integer ASC
	LIMIT 1
	INTO time_slots;