diff --git a/sheets436/src/main/java/edu/umd/cmsc436/sheets/Sheets.java b/sheets436/src/main/java/edu/umd/cmsc436/sheets/Sheets.java index 3593169..ab58377 100644 --- a/sheets436/src/main/java/edu/umd/cmsc436/sheets/Sheets.java +++ b/sheets436/src/main/java/edu/umd/cmsc436/sheets/Sheets.java @@ -175,11 +175,6 @@ protected void showGooglePlayErrorDialog () { apiAvailability.getErrorDialog(hostActivity, statusCode, host.getRequestCode(Action.REQUEST_PLAY_SERVICES)).show(); } - public static float unixToSheetsEpoch(long milliseconds) { - // days between 1/1/1900 and 1/1/1970, horribly inflexible timezone adjustment, then number of milliseconds in a day - return 25569 + ((milliseconds-14400000)/86400000f); - } - public interface Host { int getRequestCode(Action action); diff --git a/sheets436/src/main/java/edu/umd/cmsc436/sheets/WriteDataTask.java b/sheets436/src/main/java/edu/umd/cmsc436/sheets/WriteDataTask.java index 037cb01..ad30c8b 100644 --- a/sheets436/src/main/java/edu/umd/cmsc436/sheets/WriteDataTask.java +++ b/sheets436/src/main/java/edu/umd/cmsc436/sheets/WriteDataTask.java @@ -13,8 +13,11 @@ import com.google.api.services.sheets.v4.model.ValueRange; import java.io.IOException; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Date; import java.util.List; +import java.util.Locale; /** * Background task to write the data @@ -103,13 +106,12 @@ private void writeToPrivate(WriteData wd) throws IOException { rowIdx++; } } - // DON"T hardcode the E part TODO - String updateCell = wd.testType.toId() + "!A" + rowIdx + ":E" + rowIdx; + + String updateCell = wd.testType.toId() + "!A" + rowIdx + ":" + columnToLetter(wd.trials.length + 2) + rowIdx; List> values = new ArrayList<>(); List row = new ArrayList<>(); row.add(wd.userId); - // TODO put a timestamp here - row.add(2943756); + row.add(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()).format(new Date())); for (float value : wd.trials) { row.add(value); }