Commit ddb89343 authored by Florian Mühlburger's avatar Florian Mühlburger
Browse files

Reminder Active Flag wird bei Email gecheckt

parent 27307af9
Pipeline #385 failed with stages
in 9 minutes and 31 seconds
...@@ -16,8 +16,6 @@ import org.springframework.stereotype.Service; ...@@ -16,8 +16,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.thymeleaf.TemplateEngine; import org.thymeleaf.TemplateEngine;
import org.thymeleaf.context.Context; import org.thymeleaf.context.Context;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.Instant; import java.time.Instant;
import java.time.ZoneId; import java.time.ZoneId;
...@@ -55,13 +53,12 @@ public class NotificationService { ...@@ -55,13 +53,12 @@ public class NotificationService {
* This is scheduled to get fired every night, at 04:00 (am). * This is scheduled to get fired every night, at 04:00 (am).
*/ */
@Scheduled(cron = "0 0 4 * * ?") @Scheduled(cron = "0 0 4 * * ?")
// @Scheduled(cron = "0 * * * * ?") // for testing purposes, this line triggers the method every minute, during operation use the line above // @Scheduled(cron = "0 * * * * ?") // for testing purposes, this line triggers the method every minute, during operation use the line above
public void sendNotification() { public void sendNotification() {
Page<PruefungsTermin> results = pruefungsTerminService.findAll(Pageable.unpaged()); Page<PruefungsTermin> results = pruefungsTerminService.findAll(Pageable.unpaged());
List<PruefungsTermin> resultList=results.getContent(); List<PruefungsTermin> resultList=results.getContent();
//Listen Schriftliche Prüfungen vor Klausur //Listen Schriftliche Prüfungen vor Klausur
List<PruefungsTermin> sTermin12W = filterDates(resultList, 84); List<PruefungsTermin> sTermin12W = filterDates(resultList, 84);
List<PruefungsTermin> sTermin6W = filterDates(resultList, 42); List<PruefungsTermin> sTermin6W = filterDates(resultList, 42);
...@@ -101,9 +98,10 @@ public class NotificationService { ...@@ -101,9 +98,10 @@ public class NotificationService {
Stream.of(sTerminAllb,sTerminAlla,mTerminAll).forEach(terminAll::addAll); Stream.of(sTerminAllb,sTerminAlla,mTerminAll).forEach(terminAll::addAll);
StringBuffer b = new StringBuffer(); StringBuffer b = new StringBuffer();
if(!terminAll.isEmpty()){ if(!terminAll.isEmpty()){
// Schriftliche Prüfungen vor Klausur
// Schriftliche Prüfungen vor Klausur
b.append("<h1>Prüfungserinnerung</h1> "); b.append("<h1>Prüfungserinnerung</h1> ");
if(!sTerminAllb.isEmpty()) { if(!sTerminAllb.isEmpty()) {
b.append("<h2>Schriftliche Prüfungen vor Klausur</h2> " + b.append("<h2>Schriftliche Prüfungen vor Klausur</h2> " +
...@@ -241,7 +239,7 @@ public class NotificationService { ...@@ -241,7 +239,7 @@ public class NotificationService {
DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT).withLocale(Locale.getDefault()).withZone(ZoneId.systemDefault()); DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT).withLocale(Locale.getDefault()).withZone(ZoneId.systemDefault());
b.append("<ul>"); b.append("<ul>");
for (PruefungsTermin pruefungsTermin: filteredDates) { for (PruefungsTermin pruefungsTermin: filteredDates) {
if(pruefungsTermin.getModul().getPruefung().getArt().equals(p)) { if(pruefungsTermin.getModul().getPruefung().getArt().equals(p)&&pruefungsTermin.isReminderActive()) {
b.append("<li>" + formatter.format(pruefungsTermin.getStartZeitpunkt()) + ": " + pruefungsTermin.getModul().getBezeichnung() + "</li>"); b.append("<li>" + formatter.format(pruefungsTermin.getStartZeitpunkt()) + ": " + pruefungsTermin.getModul().getBezeichnung() + "</li>");
log.debug("adding " + pruefungsTermin.getStartZeitpunkt().toString()); log.debug("adding " + pruefungsTermin.getStartZeitpunkt().toString());
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment