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 39d7626
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 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);
}
}
}
4 changes: 2 additions & 2 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ retrosearch.html.version=3.2
retrosearch.news.enable=${NEWS_ACTIVE:false}
retrosearch.news.api.key=${NEWS_API_KEY:}

retrosearch.sports.football.enable=${FOOTBALL_API_ACTIVE:false}
retrosearch.sports.football.api.key=${FOOTBALL_API_KEY:}
retrosearch.sports.football.enable=${FOOTBALL_API_ACTIVE:true}
retrosearch.sports.football.api.key=${FOOTBALL_API_KEY:3bc49205de774489934d6953fb82d06b}
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
4 changes: 2 additions & 2 deletions src/main/resources/templates/football.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ <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>
Expand Down

0 comments on commit 39d7626

Please sign in to comment.