Skip to content

Commit

Permalink
#325 remove getCategoriesContainingTickets call, remove ticketcategor…
Browse files Browse the repository at this point in the history
…ywithstatistic
  • Loading branch information
syjer committed Aug 14, 2017
1 parent 7a973e1 commit 75b769b
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 366 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -520,15 +520,6 @@ public List<ContentLanguage> getSupportedLanguages() {
return i18nManager.getSupportedLanguages();
}

@RequestMapping(value = "/events/{eventName}/categories-containing-tickets", method = GET)
public List<TicketCategoryModification> getCategoriesWithTickets(@PathVariable("eventName") String eventName, Principal principal) {
Event event = loadEvent(eventName, principal);
return eventStatisticsManager.loadTicketCategoriesWithStats(event).stream()
.filter(tc -> !tc.getTickets().isEmpty())
.map(tc -> TicketCategoryModification.fromTicketCategory(tc.getTicketCategory(), tc.getDescription(), event.getZoneId()))
.collect(toList());
}

@RequestMapping(value = "/events/{eventName}/category/{categoryId}/ticket", method = GET)
public List<TicketWithStatistic> getTicketsInCategory(@PathVariable("eventName") String eventName, @PathVariable("categoryId") int categoryId, Principal principal) {
Event event = loadEvent(eventName, principal);
Expand Down
15 changes: 0 additions & 15 deletions src/main/java/alfio/manager/EventStatisticsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import alfio.manager.user.UserManager;
import alfio.model.*;
import alfio.model.modification.TicketCategoryWithStatistic;
import alfio.model.modification.TicketWithStatistic;
import alfio.repository.*;
import alfio.util.EventUtil;
Expand Down Expand Up @@ -118,20 +117,6 @@ public EventWithAdditionalInfo getEventWithAdditionalInfo(String eventName, Stri
return new EventWithAdditionalInfo(event, tWithInfo, eventStatistic, description, grossIncome);
}

public List<TicketCategoryWithStatistic> loadTicketCategoriesWithStats(Event event) {

List<TicketCategory> categories = loadTicketCategories(event);
List<Integer> ticketCategoriesIds = categories.stream().map(TicketCategory::getId).collect(Collectors.toList());
Map<Integer, Map<String, String>> descriptions = ticketCategoryDescriptionRepository.descriptionsByTicketCategory(ticketCategoriesIds);
Map<Integer, List<SpecialPrice>> specialPrices = specialPriceRepository.findAllByCategoriesIdsMapped(ticketCategoriesIds);

return loadTicketCategories(event).stream()
.map(tc -> new TicketCategoryWithStatistic(tc, loadModifiedTickets(tc.getEventId(), tc.getId()),
specialPrices.get(tc.getId()), event, descriptions.get(tc.getId())))
.sorted()
.collect(toList());
}

private List<TicketCategory> loadTicketCategories(Event event) {
return ticketCategoryRepository.findByEventId(event.getId());
}
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion src/main/java/alfio/util/PreReservedTicketDistributor.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package alfio.util;

import alfio.model.TicketCategoryStatisticView;
import alfio.model.modification.TicketCategoryWithStatistic;
import org.apache.commons.lang3.tuple.Pair;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1445,7 +1445,7 @@


$q.all([EventService.getSelectedLanguages($stateParams.eventName),
EventService.getCategoriesContainingTickets($stateParams.eventName), EventService.getEvent($stateParams.eventName)])
EventService.getEvent($stateParams.eventName)])
.then(function(results) {
$scope.messages = _.map(results[0].data, function(r) {
return {
Expand All @@ -1459,10 +1459,10 @@
});
$scope.fullName = 'John Doe';

$scope.categories = results[1].data;
$scope.categories = results[1].data.event.ticketCategories;
$scope.categoryId = undefined;

var eventDescriptor = results[2].data;
var eventDescriptor = results[1].data;
$scope.organization = eventDescriptor.organization;
$scope.eventName = eventDescriptor.event.shortName;
});
Expand Down
3 changes: 0 additions & 3 deletions src/main/webapp/resources/js/admin/service/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,6 @@
var queryString = angular.isDefined(categoryId) && categoryId !== "" ? '?categoryId='+categoryId : '';
return $http['post']('/admin/api/events/'+eventName+'/messages/send'+queryString, messages).error(HttpErrorHandler.handle);
},
getCategoriesContainingTickets: function(eventName) {
return $http['get']('/admin/api/events/'+eventName+'/categories-containing-tickets')
},
getFields : function(eventName) {
return $http['get']('/admin/api/events/'+eventName+'/fields');
},
Expand Down
Loading

0 comments on commit 75b769b

Please sign in to comment.