Commits

Juan Carlos Picado Herrera committed f3b685a

Setup Improvements

  • Participants
  • Parent commits c04b2be

Comments (0)

Files changed (4)

enme-business/src/main/java/org/encuestame/business/service/AbstractSurveyService.java

         final TweetPollSwitch tPollSwitch = new TweetPollSwitch();
         tPollSwitch.setAnswers(answer);
         tPollSwitch.setTweetPoll(tweetPoll);
+        //FIXME: Verfy if it these code already exist.
         tPollSwitch.setCodeTweet(MD5Utils.shortMD5(Calendar.getInstance()
                 .getTimeInMillis() + answer.getAnswer()));
         tPollSwitch.setDateUpdated(Calendar.getInstance().getTime());

enme-business/src/main/java/org/encuestame/business/service/SetupService.java

                     EnMePlaceHolderConfigurer
                     .getIntegerProperty("demo.votes.by.survey"));
         } catch (Exception e) {
+            e.printStackTrace();
             log.fatal(e);
             RequestSessionMap.setErrorMessage(e.getMessage());
         }

enme-business/src/main/java/org/encuestame/business/setup/install/demo/CSVDemoParser.java

             tweetPollBean.setUserId(u.getAccount().getUid());
             tweetPollBean.setCloseNotification(Boolean.FALSE);
             tweetPollBean.setResultNotification(Boolean.FALSE);
-            //tweetPollBean.setPublishPoll(Boolean.TRUE); // always TRUE
+            // publish aleatory a publish poll.
+            int publish = RandomUtils.nextInt(10);
+            if (publish <= 7) {
+                tweetPollBean.setPublishPoll(Boolean.TRUE); // always TRUE
+            }
+
             tweetPollBean.setSchedule(Boolean.FALSE);
             try {
                 //final Question qm = createQuestion(question, u, QuestionPattern.CUSTOMIZABLE_SELECTION);

enme-utils/src/main/java/org/encuestame/utils/MD5Utils.java

 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 
+import org.apache.commons.lang.math.RandomUtils;
+
 /**
  * MD5 Utils.
  * @author Picado, Juan juanATencuestame.org
      */
     public static String shortMD5(String text) {
         try {
-            return md5(text).substring(0, 6);
+            return md5(text).substring(0, RandomUtils.nextInt(15));
         } catch (NoSuchAlgorithmException e) {
+
         } catch (UnsupportedEncodingException e) {
         }
         return "";