Commit 6be1e7e6 authored by Jan Wagemakers's avatar Jan Wagemakers

sort HTMLcontroller

parent c6939eb9
......@@ -14,6 +14,7 @@ import be.janwagemakers.controlthermostatbluetooth.Repository.ConfigurationRepos
import be.janwagemakers.controlthermostatbluetooth.Repository.RuleRepository;
import be.janwagemakers.controlthermostatbluetooth.Repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
......@@ -87,7 +88,7 @@ public class HTMLController {
@GetMapping("/rules")
public String rules(Model model) {
List<Rule> rules = new ArrayList<>();
for (Rule rule : ruleRepository.findAll()) {
for (Rule rule : ruleRepository.findAll(new Sort(Sort.Direction.ASC, "day", "hour", "min"))) {
if (rule.getUser().getId() == user.getId()) {
rules.add(rule);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment