Subversion Repositories SmartDukaan

Rev

Rev 7975 | Rev 8025 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7975 Rev 8024
Line 1631... Line 1631...
1631
    
1631
    
1632
    public String getFormattedDate(Date date){
1632
    public String getFormattedDate(Date date){
1633
    	return sdf.format(date);
1633
    	return sdf.format(date);
1634
    }
1634
    }
1635
    
1635
    
1636
    public Map<Long, Double> getScores() throws Exception{
1636
    public Map<String, Double> getScores() throws Exception{
1637
    	Long entityId = Long.parseLong(this.id);
1637
    	Long entityId = Long.parseLong(this.id);
-
 
1638
    	Map<String,Double> finalScores = new HashMap<String, Double>();
1638
    	EntityState es = CreationUtils.getEntityState(entityId);
1639
    	EntityState es = CreationUtils.getEntityState(entityId);
1639
    	if (es!=null && es.getCategoryID() > 0) {
1640
    	if (es!=null && es.getCategoryID() > 0) {
1640
	    	if((es.getCategoryID() == 10002l || es.getCategoryID() == 10003l || es.getCategoryID() == 10004l || es.getCategoryID() == 10005l) && !es.getStatus().equals(EntityStatus.UNASSIGNED)){
1641
	    	if((es.getCategoryID() == 10002l || es.getCategoryID() == 10003l || es.getCategoryID() == 10004l || es.getCategoryID() == 10005l) && !es.getStatus().equals(EntityStatus.UNASSIGNED)){
1641
		    	NewCMP cmp = new NewCMP(Arrays.asList(this.entity));
1642
		    	NewCMP cmp = new NewCMP(Arrays.asList(this.entity));
1642
		    	Map<Long, Double> score = null;
-
 
1643
				try {
1643
				try {
-
 
1644
					//get Scores on the basis of evaluation
1644
					Map<Long, Map<Long, Double>> scoreMap = cmp.getSlideScores(0);
1645
					Map<Long, Map<Long, Double>> scoreMap = cmp.getSlideScores(0);
-
 
1646
					finalScores.put("actual", cmp.getFinalScores(scoreMap).get(entityId)/10);
-
 
1647
					
-
 
1648
					Map<Long, Double> customScores = CreationUtils.getCustomSlideComparisonScores(entityId);
-
 
1649
					if(customScores != null){
-
 
1650
						//now update scoreMap if any of the slide score has been customised
-
 
1651
						for (Map.Entry<Long, Double> entry : scoreMap.get(entityId).entrySet()){
-
 
1652
							if(customScores.containsKey(entry.getKey())){
1645
					score = scoreMap.get(entityId);
1653
								entry.setValue(customScores.get(entry.getKey()));
-
 
1654
							}
-
 
1655
						}
1646
					score.put(130054L, cmp.getFinalScores(scoreMap).get(entityId)/10);
1656
						finalScores.put("custom", cmp.getFinalScores(scoreMap).get(entityId)/10);
-
 
1657
					}
1647
					
1658
					
1648
				} catch (Exception e) {
1659
				} catch (Exception e) {
1649
					System.out.println("Some error occurred");
1660
					System.out.println("Some error occurred");
1650
					e.printStackTrace();
1661
					e.printStackTrace();
1651
				}
1662
				}
1652
				DecimalFormat oneDForm = new DecimalFormat("#.#");
1663
				DecimalFormat oneDForm = new DecimalFormat("#.#");
1653
				for(Map.Entry<Long, Double> scoreEntry : score.entrySet()){
1664
				for(Map.Entry<String, Double> scoreEntry : finalScores.entrySet()){
1654
					scoreEntry.setValue(Double.valueOf(oneDForm.format(scoreEntry.getValue())));
1665
					scoreEntry.setValue(Double.valueOf(oneDForm.format(scoreEntry.getValue())));
1655
				}
1666
				}
1656
				return score;
1667
				return finalScores;
1657
	    	} else {
1668
	    	} else {
1658
	    		return new HashMap<Long, Double>();
1669
	    		return new HashMap<String, Double>();
1659
	    	}
1670
	    	}
1660
    	} else {
1671
    	} else {
1661
    		return new HashMap<Long, Double>();
1672
    		return new HashMap<String, Double>();
1662
    	}
1673
    	}
1663
    }
1674
    }
1664
    
1675
    
1665
	
1676
	
1666
}
1677
}