Merge pull request #60 from cheapy-ispp/fixed

Fixed
This commit is contained in:
Abraham Garcia 2021-04-05 19:12:18 +02:00 committed by GitHub
commit f3df2441aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 46 additions and 29 deletions

View file

@ -105,14 +105,17 @@ public class FoodOfferController {
public String processShowForm(@PathVariable("foodOfferId") int foodOfferId, Map<String, Object> model) {
FoodOffer foodOffer = this.foodOfferService.findFoodOfferById(foodOfferId);
if(!foodOffer.getStatus().equals(StatusOffer.active)) {
return "error";
if(foodOffer.getStatus().equals(StatusOffer.active)) {
model.put("foodOffer", foodOffer);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/food/foodOffersShow";
}else if(foodOffer.getStatus().equals(StatusOffer.hidden)&&(this.checkIdentity(foodOfferId))) {
model.put("foodOffer", foodOffer);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/food/foodOffersShow";
}else {
model.put("foodOffer", foodOffer);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/food/foodOffersShow";
return "error";
}
}

View file

@ -136,13 +136,17 @@ public class NuOfferController {
@GetMapping("/offers/nu/{nuOfferId}")
public String processShowForm(@PathVariable("nuOfferId") int nuOfferId, Map<String, Object> model) {
NuOffer nuOffer = this.nuOfferService.findNuOfferById(nuOfferId);
if(!nuOffer.getStatus().equals(StatusOffer.active)) {
return "error";
if(nuOffer.getStatus().equals(StatusOffer.active)) {
model.put("nuOffer", nuOffer);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/nu/nuOffersShow";
}else if(nuOffer.getStatus().equals(StatusOffer.hidden)&&(this.checkIdentity(nuOfferId))) {
model.put("nuOffer", nuOffer);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/nu/nuOffersShow";
}else {
model.put("nuOffer", nuOffer);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/nu/nuOffersShow";
return "error";
}
}

View file

@ -131,13 +131,17 @@ public class SpeedOfferController {
@GetMapping("/offers/speed/{speedOfferId}")
public String processShowForm(@PathVariable("speedOfferId") int speedOfferId, Map<String, Object> model) {
SpeedOffer speedOffer = this.speedOfferService.findSpeedOfferById(speedOfferId);
if(!speedOffer.getStatus().equals(StatusOffer.active)) {
return "error";
if(speedOffer.getStatus().equals(StatusOffer.active)) {
model.put("speedOffer", speedOffer);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/speed/speedOffersShow";
}else if(speedOffer.getStatus().equals(StatusOffer.hidden)&&(this.checkIdentity(speedOfferId))) {
model.put("speedOffer", speedOffer);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/speed/speedOffersShow";
}else {
model.put("speedOffer", speedOffer);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/speed/speedOffersShow";
return "error";
}
}

View file

@ -120,18 +120,20 @@ public class TimeOfferController {
@GetMapping("/offers/time/{timeOfferId}")
public String processShowForm(@PathVariable("timeOfferId") int timeOfferId, Map<String, Object> model) {
TimeOffer timeOffer = this.timeOfferService.findTimeOfferById(timeOfferId);
if(!timeOffer.getStatus().equals(StatusOffer.active)) {
return "error";
if(timeOffer.getStatus().equals(StatusOffer.active)) {
model.put("timeOffer", timeOffer);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/time/timeOffersShow";
} else if(timeOffer.getStatus().equals(StatusOffer.hidden)&&(this.checkIdentity(timeOfferId))) {
model.put("timeOffer", timeOffer);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/time/timeOffersShow";
}else {
model.put("timeOffer", timeOffer);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/time/timeOffersShow";
return "error";
}
}
@GetMapping(value = "/offers/time/{timeOfferId}/edit")

View file

@ -5,6 +5,7 @@ spring.datasource.data=classpath*:db/${database}/data.sql
spring.h2.console.enabled=true
spring.profiles.active=mysql
spring.datasource.url=${MYSQL_URL:jdbc:mysql://localhost/cheapy?serverTimezone=UTC}
# Web
spring.thymeleaf.mode=HTML

View file

@ -51,4 +51,7 @@ finishOffer= Fin del intervalo
name= Nombre del restaurante
status= Estado de oferta
myOffers= Ver mis Ofertas
typeMismatch=Debe ser del formato correcto
typeMismatch.java.lang.Integer=Debe ser un número
typeMismatch.java.time.LocalDateTime=Debe ser una fecha válida
typeMismatch.java.time.LocalTime=Debe ser una hora válida