Skip to content

Commit

Permalink
SAK-33588 Time now = timeService.newTime() => (sakaiproject#4987)
Browse files Browse the repository at this point in the history
Instant now = Instant.now();
  • Loading branch information
axxter99 authored and ern committed Nov 15, 2017
1 parent 5cfa590 commit c707445
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
import org.sakaiproject.assignment.api.model.AssignmentSupplementItemWithAttachment;
import org.sakaiproject.authz.api.AuthzGroupService;
import org.sakaiproject.site.api.SiteService;
import org.sakaiproject.time.api.Time;
import org.sakaiproject.time.api.TimeService;
import org.sakaiproject.user.api.User;
import org.sakaiproject.user.api.UserDirectoryService;
import org.springframework.dao.DataAccessException;
Expand Down Expand Up @@ -120,11 +118,6 @@ public void setSiteService(SiteService siteService)
m_siteService = siteService;
}

protected TimeService timeService;

public void setTimeService(TimeService timeService) {
this.timeService = timeService;
}
/********************** attachment ************************/
/**
* {@inheritDoc}
Expand Down Expand Up @@ -589,7 +582,7 @@ public boolean canViewAllPurposeItem(Assignment a)
{
if (!aItem.getHide())
{
Time now = timeService.newTime();
Instant now = Instant.now();
Date releaseDate = aItem.getReleaseDate();
Date retractDate = aItem.getRetractDate();

Expand All @@ -601,18 +594,18 @@ public boolean canViewAllPurposeItem(Assignment a)
else if (releaseDate != null && retractDate == null)
{
// has relase date but not retract date
rv = now.getTime() > releaseDate.getTime();
rv = now.toEpochMilli() > releaseDate.getTime();
}
else if (releaseDate == null && retractDate != null)
{
// has retract date but not release date
rv = now.getTime() < retractDate.getTime();
rv = now.toEpochMilli() < retractDate.getTime();
}
else if (now != null)
{
// both releaseDate and retract date are not null
// has both release and retract dates
rv = now.getTime() > releaseDate.getTime() && now.getTime() < retractDate.getTime();
rv = now.toEpochMilli() > releaseDate.getTime() && now.toEpochMilli() < retractDate.getTime();
}
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@
*/
package org.sakaiproject.assignment.impl.sort;

import org.sakaiproject.assignment.api.model.Assignment;
import org.sakaiproject.time.api.Time;

import java.time.Instant;
import java.util.Comparator;
import java.util.Date;

import org.sakaiproject.assignment.api.model.Assignment;

/**
* The AssignmentComparator class that sorts by the due date of the assignment.
Expand Down
1 change: 0 additions & 1 deletion assignment/impl/src/webapp/WEB-INF/components.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@
<property name="assignmentService" ref="org.sakaiproject.assignment.api.AssignmentService"/>
<property name="authzGroupService" ref="org.sakaiproject.authz.api.AuthzGroupService"/>
<property name="siteService" ref="org.sakaiproject.site.api.SiteService"/>
<property name="timeService" ref="org.sakaiproject.time.api.TimeService"/>
</bean>

<bean id="org.sakaiproject.assignment.impl.AssignmentGradeInfoProvider"
Expand Down

0 comments on commit c707445

Please sign in to comment.