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
Environments
Terraform modules
Monitor
Incidents
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
Marcus Eibrink-Lunzenauer
Stud.IP
Commits
93562d97
Commit
93562d97
authored
1 year ago
by
Thomas Hackl
Committed by
David Siegfried
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Resolve "SQL-Fehler, wenn "Meine Veranstaltungen" nach Studienbereich gruppiert ist"
Closes #2854 Merge request
studip/studip!1933
parent
c82b6b0a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/classes/MyRealmModel.php
+13
-6
13 additions, 6 deletions
lib/classes/MyRealmModel.php
lib/models/StudipStudyArea.class.php
+22
-0
22 additions, 0 deletions
lib/models/StudipStudyArea.class.php
with
35 additions
and
6 deletions
lib/classes/MyRealmModel.php
+
13
−
6
View file @
93562d97
...
...
@@ -666,13 +666,20 @@ class MyRealmModel
$_tmp_courses
[
$sem_key
][
''
][
$course
[
'seminar_id'
]]
=
$course
;
}
}
uksort
(
$_tmp_courses
[
$sem_key
],
function
(
$a
,
$b
)
use
(
$sem_tree_names
)
{
$the_tree
=
TreeAbstract
::
GetInstance
(
'StudipSemTree'
,
[
'build_index'
=>
true
]
);
return
(
int
)(
$the_tree
->
tree_data
[
$a
][
'index'
]
??
0
-
$the_tree
->
tree_data
[
$b
][
'index'
]
??
0
);
// Create sort order for assigned sem_tree entries.
$entries
=
StudipStudyArea
::
findMany
(
array_keys
(
$sem_tree_names
));
$order
=
[];
foreach
(
$entries
as
$entry
)
{
$order
[
$entry
->
getId
()]
=
$entry
->
getIndex
();
}
$max
=
max
(
array_map
(
'strlen'
,
$order
));
// Now sort courses by sem_tree entry order.
uksort
(
$_tmp_courses
[
$sem_key
],
function
(
$a
,
$b
)
use
(
$order
,
$max
)
{
return
(
str_pad
(
$order
[
$a
],
$max
,
'0'
)
-
str_pad
(
$order
[
$b
],
$max
,
'0'
));
});
//At this point the $_tmp_courses array is sorted by the ordering
//of the sem_tree.
//Now we have to replace the sem_tree IDs in the second layer
...
...
This diff is collapsed.
Click to expand it.
lib/models/StudipStudyArea.class.php
+
22
−
0
View file @
93562d97
...
...
@@ -610,4 +610,26 @@ class StudipStudyArea extends SimpleORMap implements StudipTreeNode
return
$ids
;
}
/**
* Constructs an index from the level hierarchy, This index is a number,
* containing the "depth" level and the priority on this level. For example,
* a node on level 2 with priority 3 will get an index of 23.
*
* @return int
*/
public
function
getIndex
()
{
$level
=
1
;
$index
=
(
string
)
$level
.
(
string
)
$this
->
priority
;
$current
=
$this
;
while
(
$current
->
getParent
())
{
$current
=
$current
->
getParent
();
$index
.
=
$level
.
$current
->
priority
;
$level
++
;
}
return
$index
;
}
}
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