Changeset a64f926
- Timestamp:
- 01/26/22 15:53:24 (3 years ago)
- Branches:
- master
- Parents:
- 6fa3d09
- Location:
- src/main/java/it/finki/charitable
- Files:
-
- 3 edited
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) { -
src/main/java/it/finki/charitable/controller/UserProfileController.java
r6fa3d09 ra64f926 148 148 { 149 149 float dailyAverage = post.getTotalFundsCollected() / (Duration.between(post.getCreatedAt().atTime(0, 0, 0), LocalDate.now().atTime(0, 0, 0)).toDays()+1); 150 float neededAverage = (post.getFundsNeeded() - post.getTotalFundsCollected()) / (Duration.between(LocalDate.now().atTime(0, 0, 0), post.getDateDue().atTime(0, 0, 0)).toDays()+1);150 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)); 151 151 152 152 if(Duration.between(LocalDate.now().atTime(0, 0, 0), post.getDateDue().atTime(0, 0, 0)).toDays() == 0) { 153 153 float hour=(float) LocalDateTime.now().getHour(); 154 154 float mins=(float) LocalDateTime.now().getMinute(); 155 hour=hour+(mins/ (float)60);156 float hourlyAverage=(dailyAverage/ (float)24);157 float neededhourlyAverage=(post.getFundsNeeded() - post.getTotalFundsCollected())/( (float)24-hour);155 hour=hour+(mins/60f); 156 float hourlyAverage=(dailyAverage/24f); 157 float neededhourlyAverage=(post.getFundsNeeded() - post.getTotalFundsCollected())/(24f-hour); 158 158 risk = (int) (hourlyAverage/neededhourlyAverage*100); 159 159 if (risk>100) -
src/main/java/it/finki/charitable/services/EmailService.java
r6fa3d09 ra64f926 65 65 try { 66 66 javaMailSender.send(message); 67 68 67 } catch (Exception e) { 69 68 emailMessageService.save(new EmailMessage(message.getTo()[0], message.getSubject(), message.getText()));
Note:
See TracChangeset
for help on using the changeset viewer.