Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/DacoConstants.java
===================================================================
diff -u -r3399163940c61c9132223c758d274486e57ff9b7 -rc16348669cdf01b5a29fd42018513fe3076f2390
--- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/DacoConstants.java (.../DacoConstants.java) (revision 3399163940c61c9132223c758d274486e57ff9b7)
+++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/DacoConstants.java (.../DacoConstants.java) (revision c16348669cdf01b5a29fd42018513fe3076f2390)
@@ -64,7 +64,7 @@
"Multimap" };
// for date parsing
- public static final DateFormat DEFAULT_DATE_FORMAT = new SimpleDateFormat("EEE MMM dd hh:mm:ss zzz yyyy");
+ public static final DateFormat DEFAULT_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
// answer options' constants
public static final int INIT_ANSWER_OPTION_COUNT = 3;
Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/dbupdates/Patch20161122.java
===================================================================
diff -u
--- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/dbupdates/Patch20161122.java (revision 0)
+++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/dbupdates/Patch20161122.java (revision c16348669cdf01b5a29fd42018513fe3076f2390)
@@ -0,0 +1,83 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+package org.lamsfoundation.lams.tool.daco.dbupdates;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.lamsfoundation.lams.tool.daco.DacoConstants;
+
+import com.tacitknowledge.util.migration.MigrationContext;
+import com.tacitknowledge.util.migration.MigrationException;
+import com.tacitknowledge.util.migration.MigrationTaskSupport;
+import com.tacitknowledge.util.migration.jdbc.DataSourceMigrationContext;
+
+public class Patch20161122 extends MigrationTaskSupport {
+ private static final Integer LEVEL = new Integer(20161122);
+
+ private static final String NAME = "FixDateFormatting";
+
+ private static final DateFormat OLD_DATE_FORMAT = new SimpleDateFormat("EEE MMM dd hh:mm:ss zzz yyyy");
+
+ public Patch20161122() {
+ setLevel(LEVEL);
+ setName(NAME);
+ }
+
+ @Override
+ public void migrate(MigrationContext context) throws MigrationException {
+ // using data source defined in application container
+ DataSourceMigrationContext ctx = (DataSourceMigrationContext) context;
+
+ Connection conn = null;
+
+ try {
+ conn = ctx.getConnection();
+ conn.setAutoCommit(false);
+
+ // read dates one by one and convert them to new format
+ PreparedStatement readQuery = conn.prepareStatement("SELECT uid, answer FROM tl_ladaco10_answers");
+ PreparedStatement updateQuery = conn
+ .prepareStatement("UPDATE tl_ladaco10_answers SET answer=? WHERE uid=?");
+ if (readQuery.execute()) {
+ ResultSet rs = readQuery.getResultSet();
+ while (rs.next()) {
+ Date date = OLD_DATE_FORMAT.parse(rs.getString(2));
+ String newFormat = DacoConstants.DEFAULT_DATE_FORMAT.format(date);
+ updateQuery.setString(1, newFormat);
+ updateQuery.setLong(2, rs.getLong(1));
+ updateQuery.executeUpdate();
+ }
+ }
+
+ ctx.commit();
+ } catch (Exception e) {
+ ctx.rollback();
+ throw new MigrationException("Problem running update; ", e);
+ }
+ }
+}
\ No newline at end of file
Index: lams_tool_daco/web/pages/learning/listRecords.jsp
===================================================================
diff -u -r9244152d4869b648c9cd21dac02ab0cb3a5187be -rc16348669cdf01b5a29fd42018513fe3076f2390
--- lams_tool_daco/web/pages/learning/listRecords.jsp (.../listRecords.jsp) (revision 9244152d4869b648c9cd21dac02ab0cb3a5187be)
+++ lams_tool_daco/web/pages/learning/listRecords.jsp (.../listRecords.jsp) (revision c16348669cdf01b5a29fd42018513fe3076f2390)
@@ -189,13 +189,7 @@
-
-
-
-
-
-
-
+
Index: lams_tool_daco/web/pages/learning/listRecordsHorizontalPart.jsp
===================================================================
diff -u -rfd2dcf51ae6adf6aee088939b8c616b981e9a6d3 -rc16348669cdf01b5a29fd42018513fe3076f2390
--- lams_tool_daco/web/pages/learning/listRecordsHorizontalPart.jsp (.../listRecordsHorizontalPart.jsp) (revision fd2dcf51ae6adf6aee088939b8c616b981e9a6d3)
+++ lams_tool_daco/web/pages/learning/listRecordsHorizontalPart.jsp (.../listRecordsHorizontalPart.jsp) (revision c16348669cdf01b5a29fd42018513fe3076f2390)
@@ -128,13 +128,7 @@
-
-
-
-
-
-
-
+