Subversion Repositories SmartDukaan

Rev

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

Rev 7965 Rev 7966
Line 35... Line 35...
35
import in.shop2020.model.v1.catalog.status;
35
import in.shop2020.model.v1.catalog.status;
36
import in.shop2020.thrift.clients.CatalogClient;
36
import in.shop2020.thrift.clients.CatalogClient;
37
import in.shop2020.util.NewCMP;
37
import in.shop2020.util.NewCMP;
38
import in.shop2020.util.Utils;
38
import in.shop2020.util.Utils;
39
 
39
 
40
import java.awt.image.CropImageFilter;
-
 
41
import java.text.DecimalFormat;
40
import java.text.DecimalFormat;
42
import java.text.MessageFormat;
41
import java.text.MessageFormat;
43
import java.text.SimpleDateFormat;
42
import java.text.SimpleDateFormat;
44
import java.util.ArrayList;
43
import java.util.ArrayList;
45
import java.util.Arrays;
44
import java.util.Arrays;
Line 1634... Line 1633...
1634
    	return sdf.format(date);
1633
    	return sdf.format(date);
1635
    }
1634
    }
1636
    
1635
    
1637
    public Map<Long, Double> getScores() throws Exception{
1636
    public Map<Long, Double> getScores() throws Exception{
1638
    	EntityState es = CreationUtils.getEntityState(entityId);
1637
    	EntityState es = CreationUtils.getEntityState(entityId);
-
 
1638
    	if (es!=null && es.getCategoryID() > 0) {
-
 
1639
	    	Category c = Catalog.getInstance().getDefinitionsContainer().getCategory(es.getCategoryID());
1639
    	if(this.expEntity.getCategory().isComparable() &&(es.equals(EntityStatus.COMPLETE) || es.equals(EntityStatus.READY))){
1640
	    	if(c.isComparable() &&(es.equals(EntityStatus.COMPLETE) || es.equals(EntityStatus.READY))){
1640
	    	NewCMP cmp = new NewCMP(Arrays.asList(this.entity));
1641
		    	NewCMP cmp = new NewCMP(Arrays.asList(this.entity));
1641
	    	Map<Long, Double> score = null;
1642
		    	Map<Long, Double> score = null;
1642
			try {
1643
				try {
1643
				Map<Long, Map<Long, Double>> scoreMap = cmp.getSlideScores();
1644
					Map<Long, Map<Long, Double>> scoreMap = cmp.getSlideScores();
1644
				score = scoreMap.get(Long.parseLong(this.id));
1645
					score = scoreMap.get(Long.parseLong(this.id));
1645
				score.put(130054L, cmp.getFinalScores(scoreMap).get(Long.parseLong(this.id))/10);
1646
					score.put(130054L, cmp.getFinalScores(scoreMap).get(Long.parseLong(this.id))/10);
1646
				
1647
					
1647
			} catch (Exception e) {
1648
				} catch (Exception e) {
1648
				System.out.println("Some error occurred");
1649
					System.out.println("Some error occurred");
1649
				e.printStackTrace();
1650
					e.printStackTrace();
1650
			}
1651
				}
1651
			DecimalFormat oneDForm = new DecimalFormat("#.#");
1652
				DecimalFormat oneDForm = new DecimalFormat("#.#");
1652
			for(Map.Entry<Long, Double> scoreEntry : score.entrySet()){
1653
				for(Map.Entry<Long, Double> scoreEntry : score.entrySet()){
1653
				scoreEntry.setValue(Double.valueOf(oneDForm.format(scoreEntry.getValue())));
1654
					scoreEntry.setValue(Double.valueOf(oneDForm.format(scoreEntry.getValue())));
1654
			}
1655
				}
1655
			return score;
1656
				return score;
-
 
1657
	    	} else {
-
 
1658
	    		return new HashMap<Long, Double>();
-
 
1659
	    	}
1656
    	} else {
1660
    	} else {
1657
    		return new HashMap<Long, Double>();
1661
    		return new HashMap<Long, Double>();
1658
    	}
1662
    	}
1659
    }
1663
    }
1660
    
1664