Skip to content
Snippets Groups Projects

Resolve "As a user, I want to see all trails across a town and seamlessly move between them."

2 files
+ 13
2
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -2,6 +2,7 @@ package Team5.SmartTowns.trails;
@@ -2,6 +2,7 @@ package Team5.SmartTowns.trails;
import lombok.Data;
import lombok.Data;
 
import java.io.File;
import java.util.List;
import java.util.List;
@Data
@Data
@@ -10,7 +11,8 @@ public class Trail {
@@ -10,7 +11,8 @@ public class Trail {
new Trail(1,"Trail1", "This is trail one"),
new Trail(1,"Trail1", "This is trail one"),
new Trail(2,"Trail2", "This is trail two"),
new Trail(2,"Trail2", "This is trail two"),
new Trail(3,"Trail3", "This is trail three"),
new Trail(3,"Trail3", "This is trail three"),
new Trail(4,"Trail4", "This is trail four")
new Trail(4,"Trail4", "This is trail four"),
 
new Trail(5,"Trail5", "This is trail five, it has no image")
);
);
int id;
int id;
String name;
String name;
@@ -23,6 +25,15 @@ public class Trail {
@@ -23,6 +25,15 @@ public class Trail {
this.id = id;
this.id = id;
this.name = name;
this.name = name;
this.description = description;
this.description = description;
imgPath = "images/trails/trail" + id + ".jpg";
imgPath = findImagePath();
 
}
 
 
private String findImagePath(){
 
/* Finds the image in the Path folder, if image is not found assigns default image */
 
String imgPath = "images/trails/trail" + id + ".jpg";
 
String notFoundPath = "images/trails/trailNotFound.jpg";
 
 
File imgFile = new File("src/main/resources/static/" + imgPath);
 
return imgFile.exists() ? imgPath : notFoundPath;
}
}
}
}
Loading