Skip to content

Commit a2c8c52

Browse files
Added check_3
1 parent d6605a0 commit a2c8c52

File tree

5 files changed

+7
-9
lines changed

5 files changed

+7
-9
lines changed

app/src/main/java/hexlet/code/controller/UrlChecksController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static void check(Context ctx) throws SQLException {
3939

4040
var createdAt = LocalDateTime.now();
4141

42-
var urlCheck = new UrlCheck(statusCode, h1, title, description, createdAt);
42+
var urlCheck = new UrlCheck(statusCode, h1, title, description);
4343
urlCheck.setUrlId(urlId);
4444
UrlCheckRepository.save(urlCheck);
4545
System.out.println("[DEBUG] Сохранили новую проверку для urlId=" + urlId);

app/src/main/java/hexlet/code/controller/UrlsController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import java.sql.SQLException;
1818
import java.time.LocalDateTime;
1919
import java.util.Collections;
20-
import java.util.HashMap;
2120
import java.util.List;
2221
import java.util.Map;
2322
import java.util.stream.Collectors;
@@ -97,6 +96,7 @@ public static void show(Context ctx) throws SQLException {
9796

9897
var page = new UrlPage(url, checks);
9998
String message = ctx.consumeSessionAttribute("message");
99+
System.out.println("[DEBUG] message in show = " + message);
100100
page.setMessage(message);
101101

102102
ctx.render("urls/show.jte", Collections.singletonMap("page", page));

app/src/main/java/hexlet/code/model/UrlCheck.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ public class UrlCheck {
1616
private String description;
1717
private LocalDateTime createdAt;
1818

19-
public UrlCheck(int statusCode, String h1, String title, String description, LocalDateTime createdAt) {
19+
public UrlCheck(int statusCode, String h1, String title, String description) {
2020
this.statusCode = statusCode;
2121
this.h1 = h1;
2222
this.title = title;
2323
this.description = description;
24-
this.createdAt = createdAt;
2524
}
2625
}

app/src/main/java/hexlet/code/repository/UrlCheckRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ private static UrlCheck mapRowToUrlCheck(ResultSet rs) throws SQLException {
118118
rs.getInt("status_code"),
119119
rs.getString("h1"),
120120
rs.getString("title"),
121-
rs.getString("description"),
122-
rs.getTimestamp("created_at").toLocalDateTime()
121+
rs.getString("description")
123122
);
123+
check.setCreatedAt(rs.getTimestamp("created_at").toLocalDateTime());
124124
check.setId(rs.getLong("id"));
125125
check.setUrlId(rs.getLong("url_id"));
126126
return check;

app/src/main/resources/templates/urls/show.jte

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ content = @`
1111
<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/>
1212
</symbol>
1313
</svg>
14-
@if(StringUtils.contains(page.getMessage(), "Проверка не прошла"))
14+
@if(page.getMessage() != null && page.getMessage().contains("Проверка не пройдена"))
1515
<div class="alert alert-danger d-flex align-items-center alert-dismissible fade show m-0" role="alert">
1616
<svg class="bi flex-shrink-0 me-2" role="img" aria-label="Danger:"><use xlink:href="#exclamation-triangle-fill"/></svg>
1717
<div>
@@ -20,8 +20,7 @@ content = @`
2020
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
2121
</div>
2222
@endif
23-
24-
<div class="mx-4 mt-4 mb-0">
23+
<div class="mx-4 mt-4 mb-0">
2524
<div class="flex-row fs-6">
2625
<table class="table table-light table-hover table-bordered border-white border-4 caption-top table-responsive">
2726
<caption class="fs-4">Сайт <span class="fw-light fst-italic">${page.getUrl().getName()}</span></caption>

0 commit comments

Comments
 (0)