Ignore:
Timestamp:
03/06/23 19:58:20 (22 months ago)
Author:
DenicaKj <dkorvezir@…>
Branches:
master
Children:
40935d3
Parents:
7215773
Message:

fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/moviezone/web/HomeController.java

    r7215773 r8a18cf5  
    199199            response.sendRedirect("/login");
    200200        }
    201        
     201
    202202    }
    203203    @GetMapping("/registerWorker")
     
    396396        Customer customer=customerService.findByUsername(request.getRemoteUser());
    397397        Projection projection1=projectionService.findById(projection.intValue());
    398         if(projection1.getDiscount().equals(discount)){
     398        if(projection1.getDiscount()!=null && projection1.getDiscount().getCode().equals(discount)){
    399399            t=ticketService.saveWithDiscount(LocalDate.now(),customer,projection1,projection1.getDiscount(),seatService.getSeatById(id_seat.intValue()).get());
     400            Integer price=ticketService.priceForTicket(t.getId_ticket());
     401            price+=seatService.getSeatById(id_seat.intValue()).get().getCategory().getExtra_amount();
     402            price-=(price*projection1.getDiscount().getPercent())/100;
     403            t.setPrice(price);
    400404        }else{
    401405            t=ticketService.saveWithout(LocalDate.now(),customer,projection1,seatService.getSeatById(id_seat.intValue()).get());
    402         }
    403         Integer price=ticketService.priceForTicket(t.getId_ticket());
    404         t.setPrice(price);
     406            Integer price=ticketService.priceForTicket(t.getId_ticket());
     407            price+=seatService.getSeatById(id_seat.intValue()).get().getCategory().getExtra_amount();
     408            t.setPrice(price);
     409        }
     410
    405411        return "redirect:/myTickets";
    406412    }
Note: See TracChangeset for help on using the changeset viewer.