Subversion Repositories SmartDukaan

Rev

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

Rev 1952 Rev 1977
Line 145... Line 145...
145
    
145
    
146
    public List<Double> getOverallScores(){
146
    public List<Double> getOverallScores(){
147
        List<Double> overallScores = new ArrayList<Double>();
147
        List<Double> overallScores = new ArrayList<Double>();
148
        for(String productId : productSlideScores.keySet()){
148
        for(String productId : productSlideScores.keySet()){
149
            Map<String, Double> slideScores = productSlideScores.get(productId);
149
            Map<String, Double> slideScores = productSlideScores.get(productId);
150
            double veryImportantSlidesScore = 0.0;
150
            double commulativeWeightedScore = 0.0;
151
            double regularSlidesScore = 0.0;
151
            double commulativeWeights = 0.0;
152
            double notSoImportantSlidesScore = 0.0;
-
 
153
            int veryImportantSlidesCount = 0;
-
 
154
            int regularSlidesCount = 0;
-
 
155
            int notSoImportantSlidesCount = 0;
-
 
156
            
152
            
157
            for(String slideName: slideNameImportanceMap.keySet()){
153
            for(String slideName: slideNameImportanceMap.keySet()){
158
                double score = 0.0;
154
                double score = 0.0;
159
                if(slideScores.get(slideName) != null){
155
                if(slideScores.get(slideName) != null){
160
                    score = slideScores.get(slideName);
156
                    score = slideScores.get(slideName);
161
                }
157
                }
162
                String importance = slideNameImportanceMap.get(slideName);
158
                String importance = slideNameImportanceMap.get(slideName);
163
                if(importance.equals("V. Imp")){
159
                if(importance.equals("V. Imp")){
164
                    veryImportantSlidesScore += score;
160
                    commulativeWeightedScore += score*55;
165
                    veryImportantSlidesCount++;
161
                    commulativeWeights += 55;
166
                }
162
                }
167
                if(importance.equals("Imp")){
163
                if(importance.equals("Imp")){
168
                    regularSlidesScore += score;
164
                    commulativeWeightedScore += score*30;
169
                    regularSlidesCount++;
165
                    commulativeWeights += 30;
170
                }
166
                }
171
                if(importance.equals("Not Imp")){
167
                if(importance.equals("Not Imp")){
172
                    notSoImportantSlidesScore += score;
168
                    commulativeWeightedScore += score*15;
173
                    notSoImportantSlidesCount++;
169
                    commulativeWeights += 15;
174
                }
170
                }
175
            }
171
            }
176
            System.out.println(veryImportantSlidesScore + " \n" + veryImportantSlidesCount + " \n" + regularSlidesScore + " \n" + regularSlidesCount + " \n" + notSoImportantSlidesScore + " \n" + notSoImportantSlidesCount);
-
 
177
            double weightedScore = (55*veryImportantSlidesScore/veryImportantSlidesCount + 30*regularSlidesScore/regularSlidesCount + 15*notSoImportantSlidesScore/notSoImportantSlidesCount)/100;
172
            double weightedScore = commulativeWeightedScore/commulativeWeights;
178
            
173
            
179
            DecimalFormat oneDForm = new DecimalFormat("#.#");
174
            DecimalFormat oneDForm = new DecimalFormat("#.#");
180
            weightedScore = Double.valueOf(oneDForm.format(weightedScore));
175
            weightedScore = Double.valueOf(oneDForm.format(weightedScore));
181
            
176
            
182
            overallScores.add(weightedScore);
177
            overallScores.add(weightedScore);