== **[[span(style=color: #FF0000, Напредни извештаи од базата (SQL и складирани процедури))]]** == **[[span(style=color: #BF1B1B, 1. Листање(приказ) на денешни events, count на денешни часови, испити и tasks:)]]** == **[[span(style=color: #BF1B1B, 2. Листање(приказ) на таскови за наредните три дена:)]]** == **[[span(style=color: #BF1B1B, 3. Листање(приказ) на испити за наредните седум дена:)]]** == **[[span(style=color: #BF1B1B, 4. Листање(приказ) на сите евенти за одредена недела:)]]** {{{ DECLARE correct_student_id INT; SET correct_student_id = 11111; SELECT * FROM ( SELECT ce.calendar_event_id, ce.event_name, ce.event_type, ce.event_start_time, ce.event_end_time, nre.event_date FROM student_event AS se JOIN calendar_event AS ce ON se.calendar_event_id = ce.calendar_event_id JOIN non_repeating_events AS nre ON ce.calendar_event_id = nre.calendar_event_id WHERE nre.event_date >= date_trunc('week', CURRENT_DATE) AND nre.event_date < date_trunc('week', CURRENT_DATE) + INTERVAL '1 week' AND se.student_id = correct_student_id UNION SELECT ce.calendar_event_id, ce.event_name, ce.event_type, ce.event_start_time, ce.event_end_time, CASE WHEN re.event_week_day = 'MONDAY' THEN date_trunc('week', CURRENT_DATE)::DATE WHEN re.event_week_day = 'TUESDAY' THEN date_trunc('week', CURRENT_DATE) + interval '1 day'::DATE WHEN re.event_week_day = 'WEDNESDAY' THEN date_trunc('week', CURRENT_DATE) + interval '2 days'::DATE WHEN re.event_week_day = 'THURSDAY' THEN date_trunc('week', CURRENT_DATE) + interval '3 days'::DATE WHEN re.event_week_day = 'FRIDAY' THEN date_trunc('week', CURRENT_DATE) + interval '4 days'::DATE WHEN re.event_week_day = 'SATURDAY' THEN date_trunc('week', CURRENT_DATE) + interval '5 days'::DATE WHEN re.event_week_day = 'SUNDAY' THEN date_trunc('week', CURRENT_DATE) + interval '6 days'::DATE END AS event_date FROM student_event AS se JOIN calendar_event AS ce ON se.calendar_event_id = ce.calendar_event_id JOIN repeating_events AS re ON ce.calendar_event_id = re.calendar_event_id WHERE re.starting_date <= ( CASE WHEN re.event_week_day = 'MONDAY' THEN date_trunc('week', CURRENT_DATE)::DATE WHEN re.event_week_day = 'TUESDAY' THEN date_trunc('week', CURRENT_DATE) + interval '1 day'::DATE WHEN re.event_week_day = 'WEDNESDAY' THEN date_trunc('week', CURRENT_DATE) + interval '2 days'::DATE WHEN re.event_week_day = 'THURSDAY' THEN date_trunc('week', CURRENT_DATE) + interval '3 days'::DATE WHEN re.event_week_day = 'FRIDAY' THEN date_trunc('week', CURRENT_DATE) + interval '4 days'::DATE WHEN re.event_week_day = 'SATURDAY' THEN date_trunc('week', CURRENT_DATE) + interval '5 days'::DATE WHEN re.event_week_day = 'SUNDAY' THEN date_trunc('week', CURRENT_DATE) + interval '6 days'::DATE END ) AND re.ending_date >= ( CASE WHEN re.event_week_day = 'MONDAY' THEN date_trunc('week', CURRENT_DATE)::DATE WHEN re.event_week_day = 'TUESDAY' THEN date_trunc('week', CURRENT_DATE) + interval '1 day'::DATE WHEN re.event_week_day = 'WEDNESDAY' THEN date_trunc('week', CURRENT_DATE) + interval '2 days'::DATE WHEN re.event_week_day = 'THURSDAY' THEN date_trunc('week', CURRENT_DATE) + interval '3 days'::DATE WHEN re.event_week_day = 'FRIDAY' THEN date_trunc('week', CURRENT_DATE) + interval '4 days'::DATE WHEN re.event_week_day = 'SATURDAY' THEN date_trunc('week', CURRENT_DATE) + interval '5 days'::DATE WHEN re.event_week_day = 'SUNDAY' THEN date_trunc('week', CURRENT_DATE) + interval '6 days'::DATE END ) AND (EXTRACT(day FROM date_trunc('week', CURRENT_DATE) - date_trunc('week', ( CASE WHEN re.event_week_day = 'MONDAY' THEN date_trunc('week', CURRENT_DATE)::DATE WHEN re.event_week_day = 'TUESDAY' THEN date_trunc('week', CURRENT_DATE) + interval '1 day'::DATE WHEN re.event_week_day = 'WEDNESDAY' THEN date_trunc('week', CURRENT_DATE) + interval '2 days'::DATE WHEN re.event_week_day = 'THURSDAY' THEN date_trunc('week', CURRENT_DATE) + interval '3 days'::DATE WHEN re.event_week_day = 'FRIDAY' THEN date_trunc('week', CURRENT_DATE) + interval '4 days'::DATE WHEN re.event_week_day = 'SATURDAY' THEN date_trunc('week', CURRENT_DATE) + interval '5 days'::DATE WHEN re.event_week_day = 'SUNDAY' THEN date_trunc('week', CURRENT_DATE) + interval '6 days'::DATE END ))) % (7 * re.repeats_every_n_weeks)) = 0 AND se.student_id = correct_student_id ) AS Result ORDER BY event_date, -- Order by day of the week event_start_time; -- Order by time }}} == **[[span(style=color: #BF1B1B, 5. Листање(приказ) на сите евенти за одреден семестар:)]]** == **[[span(style=color: #BF1B1B, 6. Листање(приказ) на сите евенти и task-ови за зададен предмет:)]]** == **[[span(style=color: #BF1B1B, 7. Листање(приказ) на сите на сите книги и автори по одреден предмет:)]]** == **[[span(style=color: #BF1B1B, 8. Приказна на сите feedbacks (описи и наслови на feedback) со оценка помала од 3:)]]**