Skip to content

Commit

Permalink
use arrays before empty them
Browse files Browse the repository at this point in the history
  • Loading branch information
bbannon committed Mar 27, 2024
1 parent 9193838 commit f14db89
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions view_l.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,13 @@
}

$e_save = $re_save = [];
for ( $i = 0, $cnt = count ( $viewusers ); $i < $cnt; $i++ ) {
$events = $repeated_events = [];
foreach ( $viewusers as $i ) {
/* Pre-Load the repeated events for quicker access */
$repeated_events = read_repeated_events ( $viewusers[$i], $startdate, $enddate, '' );
$re_save = array_merge ( $re_save, $repeated_events );
$re_save = read_repeated_events ( $i, $startdate, $enddate, '' );
/* Pre-load the non-repeating events for quicker access */
$events = read_events ( $viewusers[$i], $startdate, $enddate );
$e_save = array_merge ( $e_save, $events );
$e_save = read_events ( $i, $startdate, $enddate );
}
$events = $repeated_events = [];

for ( $i = 0, $cnt = count ( $e_save ); $i < $cnt; $i++ ) {
$should_add = 1;
Expand Down

1 comment on commit f14db89

@bbannon
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems a little silly to build 2 arrays, merge them with empty arrays, then delete them before actually using hem.

Please sign in to comment.