// Untuk menentukan suatu konsumsi merupakan yang terakhir di input
  private boolean isConsumptionNotLastOfTheDay(DateTime day, Goods goods, Date timestamp) {
    Date startDate = day.withMillisOfDay(0).toDate();
    Date endDate = day.withMillisOfDay(day.millisOfDay().getMaximumValue()).toDate();

    List<GoodsConsumption> goodList =
        server
            .find(GoodsConsumption.class)
            .where()
            .between("consumptionDate", startDate, endDate)
            .eq("goods", goods)
            .findList();
    for (GoodsConsumption consumption : goodList) {
      DateTime consumptionTimeStamp = new DateTime(consumption.getTimestamp());
      DateTime currentTimeStamp = new DateTime(timestamp);
      if (consumptionTimeStamp.isAfter(currentTimeStamp)) {
        return true;
      }
    }

    return false;
  }
예제 #2
0
  public AssignedWorkTO getAssignedWorkFor(User user) {
    DateTime now = new DateTime();
    DateTime dayStart = now.withMillisOfDay(0);
    DateTime dayEnd = dayStart.plusDays(1);
    Interval interval = new Interval(dayStart, dayEnd);

    Collection<Task> tasks = taskDAO.getAllTasks(user, interval);
    Collection<Story> stories =
        storyDAO.getAllIterationStoriesByResponsibleAndInterval(user, interval);

    AssignedWorkTO returnable = transferObjectBusiness.constructAssignedWorkTO(tasks, stories);

    Collection<Story> finalStories = new ArrayList<Story>();
    finalStories.addAll(returnable.getStories());
    Collection<StoryRank> iterationRanks = storyRankDAO.getIterationRanksForStories(finalStories);
    Collection<StoryRank> projectRanks = storyRankDAO.getProjectRanksForStories(finalStories);

    setStoryRanks(returnable.getStories(), iterationRanks, projectRanks);

    return returnable;
  }
예제 #3
0
 private DateTime floor(DateTime dateTime) {
   return dateTime.withMillisOfDay(0);
 }
예제 #4
0
 private DateTime getFirstScheduledTimeOnDay(DateTime nextDay) {
   return nextDay.withMillisOfDay(
       schedule.getSignalTimes().get(0).getFixedTimeMillisFromMidnight());
 }