コード例 #1
0
ファイル: ContentLogService.java プロジェクト: Caballarii/www
  /** Set a content log. */
  public void setLog(
      String contentId, int duration, int score, User user, ContentLogContentType contenttype) {
    user = checkUser(user);
    ContentLog cl = new ContentLog();
    ContentLog old = contentLogDao.queryLastLog(contentId, user.getUserId());
    if (old == null) {
      cl.setType(ContentLogType.FINISH);
    } else {
      cl.setType(ContentLogType.REVIEW);
    }

    cl.setContentId(contentId);
    cl.setContentType(contenttype);
    cl.setDuration(duration);
    cl.setEnterTime(new Date(DateUtils.getDatabaseDate().getTime() - duration));
    cl.setLeaveTime(DateUtils.getDatabaseDate());
    cl.setLessonId(-1);
    cl.setLogKey("NOT USING");
    cl.setScore(score);
    cl.setTag1("NOT USING");
    cl.setTag2("NOT USING");
    cl.setUserId(user.getUserId());
    cl.setUserName(user.getUserName());
    contentLogDao.saveContentLog(cl);
  }