Skip to content

Commit

Permalink
add basic templating
Browse files Browse the repository at this point in the history
  • Loading branch information
garamb1 committed Mar 30, 2024
1 parent cf61db3 commit cd7fbdd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

@Slf4j
@Component
@ConditionalOnProperty(value = "retrosearch.news.enable", havingValue = "true")
public class FootballScheduledTask {
@ConditionalOnProperty(value = "retrosearch.sports.football.enable", havingValue = "true")
public class FootballDataScheduledTask {

@Autowired private FootballDataOrgClient apiClient;

Expand All @@ -21,11 +21,11 @@ public class FootballScheduledTask {
@Scheduled(fixedRate = 30 * 60 * 1000)
private void updateFootballData() {
try {
log.info("Updating article lists...");
log.info("Updating football result list...");
FootballDataResponse footballData = apiClient.fetchFootballData();
repository.updateAll(footballData.matches());
} catch (Exception e) {
log.error("Article list update failed:", e);
log.error("Football result list update failed:", e);
}
}
}
2 changes: 1 addition & 1 deletion src/main/resources/templates/error.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<body>
<h1>Error - RetroSearch</h1>
<h2>Sorry, something went wrong :(</h2>
<img th:src="@{img/error.gif}">
<img th:src="@{/img/error.gif}">
<br>
<a href="/">Go Back</a>
<br>
Expand Down
5 changes: 2 additions & 3 deletions src/main/resources/templates/football.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ <h2>Latest Football Results</h2>
<p>Updated: <em th:text="${updatedAt}"></em></p>
<ul>
<li th:each="matchesByCountry: ${results}">
<h3 th:text="matchesByCountry.key"></h3>
<h3 th:text="${matchesByCountry.key}"></h3>
<ul>
<li th:each="match: matchesByCountry.key.value">
<li th:each="match: ${matchesByCountry.value}">
<p th:text="${match.utcDate}"></p>
<p th:text="${match.competition.name}"></p>
<p th:text="${match.homeTeam.name}"></p>
<p th:text="${match.awayTeam.name}"></p>
<p th:text="${match.awayTeam.name}"></p>
<p th:text="${match.score.fullTime}"></p>
</li>
</ul>
Expand Down

0 comments on commit cd7fbdd

Please sign in to comment.