use of net.sourceforge.processdash.data.DateData in project processdash by dtuma.
the class TaskStatusApi method getCompletionDate.
private DateData getCompletionDate(String path) {
String dataName = path + "/Completed";
SimpleData sd = getDataContext().getSimpleValue(dataName);
if (sd instanceof DateData)
return (DateData) sd;
else
return null;
}
use of net.sourceforge.processdash.data.DateData in project processdash by dtuma.
the class TaskStatusApi method doGet.
@Override
protected void doGet() throws IOException {
checkRequestValidity();
String path = getTargetPath();
DateData completionDate = getCompletionDate(path);
JSONObject json = new JSONObject();
json.put("stat", "ok");
json.put("taskPath", path);
json.put("completionDate", completionDate == null ? null : WebApiUtils.DATE_FMT.format(completionDate.getValue()));
out.write("Content-Type: application/json\r\n\r\n");
out.write(json.toString());
out.flush();
}
use of net.sourceforge.processdash.data.DateData in project processdash by dtuma.
the class DataRepository method userPutValue.
public void userPutValue(String name, SaveableData value) {
waitForCalculations();
String aliasName = getAliasedName(name);
putValue(aliasName, value, IS_NOT_DEFAULT_VAL);
if (TIMESTAMPED_DATA_NAMES.matches(aliasName)) {
putValue(aliasName + "/Edit_Timestamp", new DateData(), IS_NOT_DEFAULT_VAL);
}
}
use of net.sourceforge.processdash.data.DateData in project processdash by dtuma.
the class DefaultTimeLoggingModel method shouldForceTimeLogEntry.
/**
* In some usage scenarios, an individual needs to mark several tasks
* complete in a row, but still reflect the fact that they "worked" on them.
* If the timer is running when the user marks a task complete, and no time
* has ever been logged against that task, round the current time log entry
* up to 1 minute if it isn't there already.
*/
private boolean shouldForceTimeLogEntry(double elapsedMinutes) {
// time log entry.
if (elapsedMinutes > 1.0)
return false;
// paused at this very moment), don't force a time log entry.
if (paused && !pauseInProgress)
return false;
// Check a user setting to see if this functionality is disabled.
if (!Settings.getBool("pauseButton.forceCompletedTaskTime", true))
return false;
// Check the data repository to see if the current task has been
// flagged as one that should never receive "forced" time log entries.
String path = currentPhase.path();
SaveableData sd = DataRepository.getInheritableValue(data, new StringBuffer(path), "Force_Completed_Task_Time");
if (sd != null && sd.getSimpleValue().test() == false)
return false;
// If time has been logged against this task in the past, don't force
// a new time log entry.
String dataName = DataRepository.createDataName(path, "Time");
if (sd != null && sd.getSimpleValue().test())
return false;
// Check to see if the current task was *just* marked complete. If so,
// force a time log entry.
dataName = DataRepository.createDataName(path, "Completed");
sd = data.getSimpleValue(dataName);
if (sd instanceof DateData) {
Date completed = ((DateData) sd).getValue();
long age = System.currentTimeMillis() - completed.getTime();
if (age < 1000) {
logger.fine("Forcing 1 minute time log entry for " + "completed task " + path);
return true;
}
}
return false;
}
use of net.sourceforge.processdash.data.DateData in project processdash by dtuma.
the class CumulativeDefectChartSnippet method addRow.
protected void addRow(ResultSet data, int row, Date d, int num, int cum) {
DateData date = new DateData(d, true);
date.setFormatAsDateOnly(true);
data.setRowName(row, date.format());
data.setData(row, 1, date);
data.setData(row, 2, new DoubleData(num));
data.setData(row, 3, new DoubleData(cum));
}
Aggregations