Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stud.IP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Diel
Stud.IP
Commits
fe0b8990
Commit
fe0b8990
authored
11 months ago
by
André Noack
Browse files
Options
Downloads
Patches
Plain Diff
Resolve #3893 "Performance des persönlichen Kalenders / Gruppenkalender ist schlecht"
Closes #3893 Merge request
studip/studip!2746
parent
bf57b4bb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
db/migrations/5.5.28_biest3893_performance_calendar.php
+25
-0
25 additions, 0 deletions
db/migrations/5.5.28_biest3893_performance_calendar.php
lib/models/calendar/CalendarDateAssignment.class.php
+19
-13
19 additions, 13 deletions
lib/models/calendar/CalendarDateAssignment.class.php
with
44 additions
and
13 deletions
db/migrations/5.5.28_biest3893_performance_calendar.php
0 → 100644
+
25
−
0
View file @
fe0b8990
<?php
final
class
Biest3893PerformanceCalendar
extends
Migration
{
public
function
description
()
{
return
'add index to calendar tables'
;
}
public
function
up
()
{
$db
=
DBManager
::
get
();
$db
->
exec
(
"DELETE FROM `calendar_date_exceptions` WHERE `date` = '1970-01-01'"
);
$db
->
exec
(
"ALTER TABLE `calendar_date_exceptions` ADD INDEX(`calendar_date_id`)"
);
$db
->
exec
(
"ALTER TABLE `calendar_dates` ADD INDEX `repetition_type` (`repetition_type`, `repetition_end`)"
);
$db
->
exec
(
"ALTER TABLE `calendar_dates` ADD INDEX `begin` (`begin`)"
);
try
{
$db
->
exec
(
"ALTER TABLE `calendar_dates` DROP INDEX `uid`"
);
}
catch
(
PDOException
$exception
)
{}
}
public
function
down
()
{
}
}
This diff is collapsed.
Click to expand it.
lib/models/calendar/CalendarDateAssignment.class.php
+
19
−
13
View file @
fe0b8990
...
...
@@ -232,29 +232,35 @@ class CalendarDateAssignment extends SimpleORMap implements Event
$sql
=
"JOIN `calendar_dates`
ON calendar_date_id = `calendar_dates`.`id`
WHERE
`calendar_date_assignments`.`range_id` = :range_id "
;
`calendar_date_assignments`.`range_id` = :range_id
AND
`access` IN ( :access_levels ) "
;
if
(
!
$with_declined
)
{
$sql
.
=
"AND `calendar_date_assignments`.`participation` <> 'DECLINED' "
;
}
$sql
.
=
"AND (
`calendar_dates`.`begin` BETWEEN :begin AND :end
OR
(`calendar_dates`.`begin` <= :end AND `calendar_dates`.`repetition_type` <> ''
AND `calendar_dates`.`repetition_end` > :begin)
OR
:begin BETWEEN `calendar_dates`.`begin` AND `calendar_dates`.`end`
)
AND
`access` IN ( :access_levels )
ORDER BY `calendar_dates`.`begin` ASC"
;
$sql_single
=
$sql
.
" AND
`calendar_dates`.`begin` < :end AND :begin < `calendar_dates`.`end`
"
;
$events
=
self
::
findBySql
(
$sql
,
[
$events
=
self
::
findBySql
(
$sql
_single
,
[
'range_id'
=>
$range_id
,
'begin'
=>
$begin
->
getTimestamp
(),
'end'
=>
$end
->
getTimestamp
(),
'access_levels'
=>
$access_levels
]);
$sql_repetition
=
$sql
.
" AND `calendar_dates`.`begin` < :end AND `calendar_dates`.`repetition_type` IN ('DAYLY', 'WEEKLY', 'MONTHLY', 'YEARLY')
AND `calendar_dates`.`repetition_end` > :begin
"
;
$events
=
array_merge
(
$events
,
self
::
findBySql
(
$sql_repetition
,
[
'range_id'
=>
$range_id
,
'begin'
=>
$begin
->
getTimestamp
(),
'end'
=>
$end
->
getTimestamp
(),
'access_levels'
=>
$access_levels
]));
$m_start
=
clone
$begin
;
$m_end
=
clone
$end
;
$events_created
=
[];
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment