Skip to content

Commit e500aa4

Browse files
committed
prof: switch default to show only own shifts
1 parent 50b09bd commit e500aa4

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

pages/listproject.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@
7676
}
7777

7878
$bottom_links[]
79-
= dolink('patches', 'Submitted patches', ['group' => $group->id]);
79+
= dolink('patches', 'Submitted patches',
80+
['group' => $group->id, 'all_shifts' => 1]);
8081

8182
function check_min($txt, $val, $min) {
8283
if ($val >= $min)

templates.php

+13-4
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,20 @@ function filter_by($filters, $extra_filters = []) {
209209

210210
$selected_year = $request->query->get('year', $all_years[0]['year']);
211211
$selected_shift = $request->query->get('shift', null);
212-
$own_shifts_only = $request->query->get('own_shifts', false) ? true : false;
212+
$all_shifts = $request->query->get('all_shifts', false) ? true : false;
213213
$selected_group = $request->query->get('group', 'all');
214214
$selected_repo = $request->query->get('repo', 'all');
215+
$own_shifts_only = !$all_shifts;
215216
$return = null;
216217

218+
if ($selected_group !== 'all' && !$request->query->has('year')) {
219+
$group = db_fetch_group_id($selected_group);
220+
if (!$group) {
221+
die('Invalid group');
222+
}
223+
$selected_year = $group->year;
224+
}
225+
217226
$selected_shift_obj = $selected_shift && $selected_shift != 'all'
218227
? db_fetch_shift_id($selected_shift) : null;
219228

@@ -287,9 +296,9 @@ function filter_by($filters, $extra_filters = []) {
287296
]);
288297
}
289298
if (in_array('own_shifts', $filters)) {
290-
$select_form->add('own_shifts', CheckboxType::class, [
291-
'label' => 'Show only own shifts',
292-
'data' => $own_shifts_only,
299+
$select_form->add('all_shifts', CheckboxType::class, [
300+
'label' => 'Show all shifts',
301+
'data' => $all_shifts,
293302
'required' => false,
294303
]);
295304
}

0 commit comments

Comments
 (0)