Changeset a64f926 for src/main/java


Ignore:
Timestamp:
01/26/22 15:53:24 (3 years ago)
Author:
KostaFortumanov <kfortumanov@…>
Branches:
master
Parents:
6fa3d09
Message:

project complete

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  
    44import it.finki.charitable.services.*;
    55import it.finki.charitable.util.FileUploadUtil;
     6import org.dom4j.rule.Mode;
    67import org.springframework.data.domain.*;
    78import org.springframework.format.annotation.DateTimeFormat;
     
    292293    @RequestMapping(value="/report", method = RequestMethod.POST)
    293294    public String report(@RequestParam Long postid,
    294                          @RequestParam String description) {
     295                         @RequestParam String description,
     296                         Model model) {
    295297
    296298        DonationPost donationPost = donationPostService.getById(postid);
     
    302304
    303305        Reason reason = new Reason();
    304         AppUser user = (AppUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
     306        AppUser user = (AppUser) model.getAttribute("user");
    305307        reason.setUser(user);
    306308        reason.setDescription(description);
     
    336338            {
    337339                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));
    339341
    340342                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  
    148148            {
    149149                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));
    151151
    152152                if(Duration.between(LocalDate.now().atTime(0, 0, 0), post.getDateDue().atTime(0, 0, 0)).toDays() == 0) {
    153153                    float hour=(float) LocalDateTime.now().getHour();
    154154                    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);
    158158                    risk = (int) (hourlyAverage/neededhourlyAverage*100);
    159159                    if (risk>100)
  • src/main/java/it/finki/charitable/services/EmailService.java

    r6fa3d09 ra64f926  
    6565        try {
    6666            javaMailSender.send(message);
    67 
    6867        } catch (Exception e) {
    6968            emailMessageService.save(new EmailMessage(message.getTo()[0], message.getSubject(), message.getText()));
Note: See TracChangeset for help on using the changeset viewer.