Legend:
- Unmodified
- Added
- Removed
-
src/main/java/it/finki/charitable/controller/DonationPostController.java
r6fa3d09 ra64f926 4 4 import it.finki.charitable.services.*; 5 5 import it.finki.charitable.util.FileUploadUtil; 6 import org.dom4j.rule.Mode; 6 7 import org.springframework.data.domain.*; 7 8 import org.springframework.format.annotation.DateTimeFormat; … … 292 293 @RequestMapping(value="/report", method = RequestMethod.POST) 293 294 public String report(@RequestParam Long postid, 294 @RequestParam String description) { 295 @RequestParam String description, 296 Model model) { 295 297 296 298 DonationPost donationPost = donationPostService.getById(postid); … … 302 304 303 305 Reason reason = new Reason(); 304 AppUser user = (AppUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();306 AppUser user = (AppUser) model.getAttribute("user"); 305 307 reason.setUser(user); 306 308 reason.setDescription(description); … … 336 338 { 337 339 float dailyAverage = post.getTotalFundsCollected() / (Duration.between(post.getCreatedAt().atTime(0, 0, 0), LocalDate.now().atTime(0, 0, 0)).toDays()+1); 338 float neededAverage = (post.getFundsNeeded() - post.getTotalFundsCollected()) / (Duration.between(LocalDate.now().atTime(0, 0, 0), post.getDateDue().atTime(0, 0, 0)).toDays()+ 1);340 float neededAverage = (post.getFundsNeeded() - post.getTotalFundsCollected()) / (Duration.between(LocalDate.now().atTime(0, 0, 0), post.getDateDue().atTime(0, 0, 0)).toDays()+(24-LocalDateTime.now().getHour()/24f)); 339 341 340 342 if(Duration.between(LocalDate.now().atTime(0, 0, 0), post.getDateDue().atTime(0, 0, 0)).toDays() == 0) {
Note:
See TracChangeset
for help on using the changeset viewer.