Subversion Repositories SmartDukaan

Rev

Rev 5552 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5552 Rev 5617
Line 69... Line 69...
69
    Map<String, Long>compare_add_map = new HashMap<String, Long>();
69
    Map<String, Long>compare_add_map = new HashMap<String, Long>();
70
    long totalComparisons = 0;
70
    long totalComparisons = 0;
71
    long totalProductsCompared = 0;
71
    long totalProductsCompared = 0;
72
    long totalProductsDeleted = 0;
72
    long totalProductsDeleted = 0;
73
    long totaldays = toDate.compareTo(fromDate);
73
    long totaldays = toDate.compareTo(fromDate);
74
    
74
    int i = 0;
-
 
75
    String err = "";
75
    for (Entity result : pq.asIterable()) {
76
    for (Entity result : pq.asIterable()) {
-
 
77
    	try{
76
    	if(result.getProperty("eventType").equals("PRODUCT_COMPARE")){
78
	    	if(result.getProperty("eventType").equals("PRODUCT_COMPARE")){
77
    		totalComparisons++;
79
	    		totalComparisons++;
78
    		String source = (String)result.getProperty("source");
80
	    		String source = (String)result.getProperty("source");
79
    		List<Long>itemIds = (List<Long>)result.getProperty("itemIds");
81
	    		List<Long>itemIds = (List<Long>)result.getProperty("itemIds");
80
    		totalProductsCompared = totalProductsCompared + itemIds.size();
82
	    		totalProductsCompared = totalProductsCompared + itemIds.size();
81
    		if(product_compare_map.containsKey(source)) {
83
	    		if(product_compare_map.containsKey(source)) {
82
    			Long source_count = product_compare_map.get(source);
84
	    			Long source_count = product_compare_map.get(source);
83
    			source_count = source_count + 1;
85
	    			source_count = source_count + 1;
84
    			product_compare_map.put(source, source_count);
86
	    			product_compare_map.put(source, source_count);
85
			} else {
87
				} else {
86
				product_compare_map.put(source, 1L);
88
					product_compare_map.put(source, 1L);
-
 
89
				}
-
 
90
			}
-
 
91
	    	else if(result.getProperty("eventType").equals("RESEARCH_ADD")){
-
 
92
				String source = (String)result.getProperty("source");
-
 
93
	    		if(compare_add_map.containsKey(source)) {
-
 
94
	    			Long source_count = compare_add_map.get(source);
-
 
95
	    			source_count = source_count + 1;
-
 
96
	    			compare_add_map.put(source, source_count);
-
 
97
				} else {
-
 
98
					compare_add_map.put(source, 1L);
-
 
99
				}
87
			}
100
			}
88
		}
-
 
89
    	else if(result.getProperty("eventType").equals("RESEARCH_ADD")){
101
	    	else if(result.getProperty("eventType").equals("RESEARCH_DELETE")){
90
			String source = (String)result.getProperty("source");
-
 
91
    		if(compare_add_map.containsKey(source)) {
-
 
92
    			Long source_count = compare_add_map.get(source);
-
 
93
    			source_count = source_count + 1;
102
	    		totalProductsDeleted++;
94
    			compare_add_map.put(source, source_count);
-
 
95
			} else {
-
 
96
				compare_add_map.put(source, 1L);
-
 
97
			}
103
			}
-
 
104
    	} catch (Exception e) {
98
		}
105
    		i++;
99
    	else if(result.getProperty("eventType").equals("RESEARCH_DELETE")){
106
    		err = err.concat(e.getStackTrace().toString());
100
    		totalProductsDeleted++;
107
    		System.out.print(e);
101
		}
108
    	}
102
    }
109
    }
103
    
110
    
104
    double avgComparisons = 0.0;
111
    double avgComparisons = 0.0;
105
    double avgProductsCompared = 0.0;
112
    double avgProductsCompared = 0.0;
106
    if(totalComparisons!=0){
113
    if(totalComparisons!=0){
Line 108... Line 115...
108
	}
115
	}
109
	if(totaldays!=0){
116
	if(totaldays!=0){
110
		avgComparisons = (double)(totalComparisons/totaldays);
117
		avgComparisons = (double)(totalComparisons/totaldays);
111
	}
118
	}
112
%>
119
%>
-
 
120
<h7 style = "display:none"><%=i%></h7>
-
 
121
<h7 style = "display:none"><%=err%></h7>
113
<h2> Comparison Stats </h2>
122
<h2> Comparison Stats </h2>
114
<table cellpadding="5" cellspacing="0" border="1">
123
<table cellpadding="5" cellspacing="0" border="1">
115
	<thead>
124
	<thead>
116
		<tr>
125
		<tr>
117
			<th>Source</th>
126
			<th>Source</th>