set groupOrder on group so we don't order the tours in each group

This commit is contained in:
Mads Rasmussen
2018-01-09 14:12:33 +01:00
parent b15def99c7
commit 0cfd5773c3
2 changed files with 8 additions and 4 deletions

View File

@@ -219,9 +219,7 @@
var tours = getTours();
setTourStatuses(tours).then(function() {
var groupedTours = [];
var sortedTours = _.sortBy(tours, 'groupOrder');
sortedTours.forEach(function (item) {
tours.forEach(function (item) {
var groupExists = false;
var newGroup = {
@@ -232,6 +230,9 @@
groupedTours.forEach(function(group){
// extend existing group if it is already added
if(group.group === item.group) {
if(item.groupOrder) {
group.groupOrder = item.groupOrder
}
groupExists = true;
group.tours.push(item)
}
@@ -240,6 +241,9 @@
// push new group to array if it doesn't exist
if(!groupExists) {
newGroup.group = item.group;
if(item.groupOrder) {
newGroup.groupOrder = item.groupOrder
}
newGroup.tours.push(item);
groupedTours.push(newGroup);
}

View File

@@ -12,7 +12,7 @@
<h5 style="margin-bottom: 10px; margin-top: 0;">Tours</h5>
<div ng-repeat="tourGroup in vm.tours" style="margin-bottom: 5px;">
<div ng-repeat="tourGroup in vm.tours | orderBy:'groupOrder'" style="margin-bottom: 5px;">
<div class="umb-help-list">