Skip to content

Commit

Permalink
#724 Fix the date of survey report from UTC to local time
Browse files Browse the repository at this point in the history
  • Loading branch information
koda-masaru committed May 16, 2017
1 parent 9fef53f commit 175ef21
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.support.project.web.control.service.Get;
import org.support.project.web.control.service.Post;
import org.support.project.web.exception.InvalidParamException;
import org.support.project.web.logic.DateConvertLogic;

import net.arnx.jsonic.JSONException;

Expand Down Expand Up @@ -239,6 +240,10 @@ public Boundary report() throws InvalidParamException {
return sendError(HttpStatus.SC_403_FORBIDDEN, "FORBIDDEN");
}
SurveyReport report = SurveyLogic.get().loadAnswers(knowledgeId, getLoginUserId());
List<SurveyAnswersEntity> answers = report.getAnswers();
for (SurveyAnswersEntity ans : answers) {
ans.setLocalDatetime(DateConvertLogic.get().convertDate(ans.getInsertDatetime(), getRequest()));
}
return send(report);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public class SurveyAnswersEntity extends GenSurveyAnswersEntity {

/** 回答者の名前 */
private String userName;
/** 回答集計を操作しているユーザのタイムゾーン/ロケールでの日付文字列 */
private String localDatetime;

/** SerialVersion */
private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -76,4 +78,18 @@ public void setUserName(String userName) {
this.userName = userName;
}

/**
* @return the localDatetime
*/
public String getLocalDatetime() {
return localDatetime;
}

/**
* @param localDatetime the localDatetime to set
*/
public void setLocalDatetime(String localDatetime) {
this.localDatetime = localDatetime;
}

}
3 changes: 2 additions & 1 deletion src/main/webapp/js/survey-answers.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ $(document).ready(function() {

result.answers.forEach(function(answer) {
var row = {};
row.answer_datetime = moment(answer.insertDatetime, 'YYYY-MM-DD HH:mm:ss.SSS').format('YYYY-MM-DD HH:mm');
row.answer_datetime = answer.localDatetime;
// row.answer_datetime = moment(answer.insertDatetime, 'YYYY-MM-DD HH:mm:ss.SSS').format('YYYY-MM-DD HH:mm');
row.answer_user = answer.userName;

answer.items.forEach(function(answerItem) {
Expand Down

0 comments on commit 175ef21

Please sign in to comment.