File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -107,6 +107,29 @@ public static function get_all_slots(): array {
107107 return $ slotsobj ;
108108 }
109109
110+ /**
111+ * Returns a list of all slots relevant for a vintage.
112+ *
113+ * @param string $vintage the vintage to filter for
114+ * @return slot[] An array of the slots.
115+ */
116+ public static function get_vintage_slots (string $ vintage ): array {
117+ global $ DB ;
118+ $ slots = $ DB ->get_records_sql (
119+ 'SELECT slot.* FROM { ' . self ::TABLE_SLOTS . '} as slot ' .
120+ 'INNER JOIN { ' . self ::TABLE_SLOT_FILTERS . '} as filter ON slot.id=filter.slotid ' .
121+ 'WHERE filter.vintage=? OR filter.vintage=NULL ' ,
122+ [$ vintage ]
123+ );
124+
125+ $ slotsobj = [];
126+ foreach ($ slots as $ slot ) {
127+ array_push ($ slotsobj , slot::from_db ($ slot ));
128+ }
129+
130+ return $ slotsobj ;
131+ }
132+
110133 /**
111134 * Returns a list of all slots belonging to a supervisor.
112135 * @param int $supervisorid userid of the supervisor in question
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ public static function get_my_slots_parameters(): external_function_parameters {
4343 public static function get_my_slots (): array {
4444 global $ USER ;
4545
46- $ allslots = slot_helper::get_all_slots ( );
46+ $ allslots = slot_helper::get_vintage_slots ( $ USER -> address );
4747
4848 $ myslots = slot_helper::filter_slots_for_user ($ allslots , $ USER );
4949
You can’t perform that action at this time.
0 commit comments