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
aba69291
Commit
aba69291
authored
9 months ago
by
Jan-Hendrik Willms
Committed by
Jan-Hendrik Willms
9 months ago
Browse files
Options
Downloads
Patches
Plain Diff
fixes #4226
Closes #4226 Merge request
studip/studip!3057
parent
2c6e90f9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
resources/vue/components/AdminCourses.vue
+22
-23
22 additions, 23 deletions
resources/vue/components/AdminCourses.vue
with
22 additions
and
23 deletions
resources/vue/components/AdminCourses.vue
+
22
−
23
View file @
aba69291
...
@@ -221,22 +221,28 @@ export default {
...
@@ -221,22 +221,28 @@ export default {
});
});
},
},
sortArray
(
array
)
{
sortArray
(
array
)
{
const
mappedFields
=
{
last_activity
:
'
last_activity_raw
'
,
semester
:
'
semester_sort
'
,
};
if
(
!
array
.
length
)
{
if
(
!
array
.
length
)
{
return
[];
return
[];
}
}
let
sortby
=
this
.
sort
.
by
;
if
(
!
this
.
activatedFields
.
includes
(
this
.
sort
.
by
)
&&
this
.
sort
.
by
!==
'
completion
'
)
{
if
(
!
this
.
activatedFields
.
includes
(
sortby
)
&&
sortby
!==
'
completion
'
)
{
return
array
;
return
array
;
}
}
const
striptags
=
function
(
text
)
{
const
striptags
=
function
(
text
)
{
if
(
typeof
text
===
"
string
"
)
{
if
(
typeof
text
===
'
string
'
)
{
return
text
.
replace
(
/
(
<
([^
>
]
+
)
>
)
/gi
,
""
);
return
text
.
replace
(
/
(
<
([^
>
]
+
)
>
)
/gi
,
""
);
}
else
{
}
else
{
return
text
;
return
text
;
}
}
};
};
let
sortby
=
mappedFields
[
this
.
sort
.
by
]
??
this
.
sort
.
by
;
// Define sort direction by this factor
// Define sort direction by this factor
const
directionFactor
=
this
.
sort
.
direction
===
'
ASC
'
?
1
:
-
1
;
const
directionFactor
=
this
.
sort
.
direction
===
'
ASC
'
?
1
:
-
1
;
...
@@ -246,35 +252,28 @@ export default {
...
@@ -246,35 +252,28 @@ export default {
sensitivity
:
'
base
'
sensitivity
:
'
base
'
});
});
let
sortFunction
=
function
(
a
,
b
)
{
let
sortFunction
=
function
(
a
,
b
)
{
return
collator
.
compare
(
striptags
(
a
[
sortby
]),
striptags
(
b
[
sortby
]));
return
collator
.
compare
(
striptags
(
a
[
sortby
]),
striptags
(
b
[
sortby
]))
||
collator
.
compare
(
striptags
(
a
.
number
),
striptags
(
b
.
number
));
};
};
if
(
sortby
===
'
last_activity
'
)
{
if
(
sortby
===
'
number
'
)
{
sortFunction
=
(
a
,
b
)
=>
a
.
last_activity_raw
-
b
.
last_activity_raw
;
}
else
if
(
sortby
===
'
name
'
)
{
sortFunction
=
(
a
,
b
)
=>
{
return
collator
.
compare
(
striptags
(
a
.
name
),
striptags
(
b
.
name
))
||
collator
.
compare
(
striptags
(
a
.
number
),
striptags
(
b
.
number
));
};
}
else
if
(
sortby
===
'
number
'
)
{
sortFunction
=
(
a
,
b
)
=>
{
sortFunction
=
(
a
,
b
)
=>
{
return
collator
.
compare
(
striptags
(
a
.
number
),
striptags
(
b
.
number
))
return
collator
.
compare
(
striptags
(
a
.
number
),
striptags
(
b
.
number
))
||
collator
.
compare
(
striptags
(
a
.
name
),
striptags
(
b
.
name
));
||
collator
.
compare
(
striptags
(
a
.
name
),
striptags
(
b
.
name
));
};
};
}
else
if
(
sortby
===
'
semester
'
)
{
sortFunction
=
(
a
,
b
)
=>
a
.
semester_sort
-
b
.
semester_sort
;
}
else
{
}
else
{
let
is_numeric
=
true
;
let
is_numeric
=
!
array
.
some
(
i
=>
{
for
(
let
i
in
array
)
{
const
value
=
striptags
(
i
[
sortby
]);
if
(
striptags
(
array
[
i
][
sortby
])
&&
isNaN
(
striptags
(
array
[
i
][
sortby
])))
{
return
value
&&
isNaN
(
parseInt
(
value
,
10
));
is_numeric
=
false
;
});
break
;
}
}
if
(
is_numeric
)
{
if
(
is_numeric
)
{
sortFunction
=
function
(
a
,
b
)
{
sortFunction
=
function
(
a
,
b
)
{
return
(
striptags
(
a
[
sortby
])
?
parseInt
(
striptags
(
a
[
sortby
]),
10
)
:
0
)
const
aValue
=
(
striptags
(
a
[
sortby
])
?
parseInt
(
striptags
(
a
[
sortby
]),
10
)
:
0
);
-
(
striptags
(
b
[
sortby
])
?
parseInt
(
striptags
(
b
[
sortby
]),
10
)
:
0
);
const
bValue
=
(
striptags
(
b
[
sortby
])
?
parseInt
(
striptags
(
b
[
sortby
]),
10
)
:
0
);
return
aValue
-
bValue
||
collator
.
compare
(
striptags
(
a
.
number
),
striptags
(
b
.
number
));
};
};
}
}
}
}
...
...
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