Skip to content

Commit

Permalink
aidr-manager: 68344980 Crisis type as mandatory field in the crisis c…
Browse files Browse the repository at this point in the history
…reation page - fixed total tweets for collection.
  • Loading branch information
kirkhm committed Sep 14, 2014
1 parent a92838c commit b8efa82
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
import qa.qcri.aidr.manager.dto.TaggerModel;
import qa.qcri.aidr.manager.hibernateEntities.AidrCollection;
import qa.qcri.aidr.manager.hibernateEntities.UserEntity;
import qa.qcri.aidr.manager.service.CollectionLogService;
import qa.qcri.aidr.manager.service.CollectionService;
import qa.qcri.aidr.manager.service.TaggerService;
import qa.qcri.aidr.manager.util.CollectionStatus;
import qa.qcri.aidr.manager.util.CollectionType;

import java.util.List;
Expand All @@ -27,6 +29,8 @@ public class ScreenController extends BaseController{
private TaggerService taggerService;
@Value("${fetchMainUrl}")
private String fetchMainUrl;
@Autowired
private CollectionLogService collectionLogService;

@RequestMapping("protected/home")
public ModelAndView home() throws Exception {
Expand Down Expand Up @@ -422,15 +426,23 @@ private ModelAndView getInteractiveViewDownload(String code, String userName){
crisisName = crisis.getName();
}

Integer collectionId = 0;
Integer collectionCount = 0;
Integer collectionId = 0;
CollectionType type = CollectionType.Twitter;
if (collection != null){
if (collection.getId() != null) {
collectionId = collection.getId();
try {
collectionCount = collectionLogService.countTotalDownloadedItemsForCollection(collectionId);
} catch (Exception e) {
e.printStackTrace();
}
}
if (collection.getCount() != null) {
collectionCount = collection.getCount();
if (collection.getCount() != null
|| collection.getStatus() != null
|| CollectionStatus.RUNNING.equals(collection.getStatus())
|| CollectionStatus.RUNNING_WARNING.equals(collection.getStatus())) {
collectionCount += collection.getCount();
}
if (collection.getCollectionType() != null) {
type = collection.getCollectionType();
Expand Down

0 comments on commit b8efa82

Please sign in to comment.