/[projects]/android/MarketStats/src/dk/thoerup/marketstats/ShowStats.java
ViewVC logotype

Diff of /android/MarketStats/src/dk/thoerup/marketstats/ShowStats.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 755 by torben, Tue May 4 03:48:37 2010 UTC revision 756 by torben, Thu May 27 08:07:28 2010 UTC
# Line 64  public class ShowStats extends HttpServl Line 64  public class ShowStats extends HttpServl
64                  return response;                  return response;
65          }          }
66                    
67          private void loadComments(String appId, MarketSession session, String locale, ArrayList<CommentBean> commentBeans) {                      private void loadComments(String appId, MarketSession session, ArrayList<CommentBean> commentBeans) {          
68                  CommentCallback commentsCb = new CommentCallback();                  CommentCallback commentsCb = new CommentCallback();
69                  commentsCb.setList( commentBeans );                  commentsCb.setList( commentBeans );
70    
71                  commentsCb.setLocale( locale );                  session.setLocale( Locale.ROOT );
72                  session.setLocale( new Locale(locale) );                  
73                                    
74                                    
75                  int start = 0;                  int start = 0;
# Line 78  public class ShowStats extends HttpServl Line 78  public class ShowStats extends HttpServl
78                          if (start > 0)                                                    if (start > 0)                          
79                                  count = Math.min(10, commentsCb.getEntryCount() );                                  count = Math.min(10, commentsCb.getEntryCount() );
80                                                    
81                          //log.warning("count=" + count + " start=" + start + " " + locale);                          //log.warning("count=" + count + " start=" + start );
82                          CommentsRequest commentsRequest = CommentsRequest.newBuilder()                          CommentsRequest commentsRequest = CommentsRequest.newBuilder()
83                          .setAppId(appId)                          .setAppId(appId)
84                          .setStartIndex(start)                          .setStartIndex(start)
# Line 89  public class ShowStats extends HttpServl Line 89  public class ShowStats extends HttpServl
89                          session.flush();                          session.flush();
90                          start +=10;                          start +=10;
91                                                    
92                          if (start >= 20)                          if (start >= 50)
93                                  break; //emergency brake                                  break; //emergency brake
94                                                    
95                  } while ( start < commentsCb.getEntryCount() );                  } while ( start < commentsCb.getEntryCount() );
# Line 125  public class ShowStats extends HttpServl Line 125  public class ShowStats extends HttpServl
125                                    
126                  if (appId != null) {                  if (appId != null) {
127    
128                          loadComments(appId, session, "da", commentBeans);                          loadComments(appId, session, commentBeans);
                         loadComments(appId, session, "en", commentBeans);  
           
                         Collections.sort(commentBeans);  
129                    
130                          sb.append("-----------------------------------------------------------------\n");                          sb.append("-----------------------------------------------------------------\n");
131                          for (CommentBean c : commentBeans) {                          for (CommentBean c : commentBeans) {
132                                  sb.append("User: " + c.author + " ("  + c.locale + ")\n");                                  sb.append("User: " + c.author + "\n");
133                                  sb.append("Rating: " + c.rating + "\n");                                  sb.append("Rating: " + c.rating + "\n");
134                                  sb.append("Time: " + new Date(c.time).toString() + "\n");                                  sb.append("Time: " + new Date(c.time).toString() + "\n");
135                                  sb.append( c.text + "\n");                                  sb.append( c.text + "\n");

Legend:
Removed from v.755  
changed lines
  Added in v.756

  ViewVC Help
Powered by ViewVC 1.1.20