fix: result report email
This commit is contained in:
parent
9d33625198
commit
9900113e33
|
|
@ -527,18 +527,18 @@ func buildHeadlineAndMessage(counts domain.ResultLog) (string, string) {
|
|||
}
|
||||
|
||||
func buildHeadlineAndMessageEmail(counts domain.ResultLog, user domain.User) (string, string, string) {
|
||||
totalIssues := counts.StatusNotFinishedCount + counts.StatusToBeFixedCount +
|
||||
counts.StatusPostponedCount + counts.StatusRemovedCount
|
||||
totalEvents := counts.StatusEndedCount + counts.StatusNotFinishedCount +
|
||||
counts.StatusToBeFixedCount + counts.StatusPostponedCount + counts.StatusRemovedCount
|
||||
totalBets := counts.StatusEndedBets + counts.StatusNotFinishedBets +
|
||||
counts.StatusPostponedBets + counts.StatusRemovedBets + counts.StatusToBeFixedBets
|
||||
totalIssues := counts.StatusNotFinishedCount + counts.StatusToBeFixedCount +
|
||||
counts.StatusPostponedCount + counts.StatusRemovedCount
|
||||
totalEvents := counts.StatusEndedCount + counts.StatusNotFinishedCount +
|
||||
counts.StatusToBeFixedCount + counts.StatusPostponedCount + counts.StatusRemovedCount
|
||||
totalBets := counts.StatusEndedBets + counts.StatusNotFinishedBets +
|
||||
counts.StatusPostponedBets + counts.StatusRemovedBets + counts.StatusToBeFixedBets
|
||||
|
||||
greeting := fmt.Sprintf("Hi %s %s,", user.FirstName, user.LastName)
|
||||
greeting := fmt.Sprintf("Hi %s %s,", user.FirstName, user.LastName)
|
||||
|
||||
if totalIssues == 0 {
|
||||
headline := "✅ Daily Results Report — All Events Processed Successfully"
|
||||
plain := fmt.Sprintf(`%s
|
||||
if totalIssues == 0 {
|
||||
headline := "✅ Daily Results Report — All Events Processed Successfully"
|
||||
plain := fmt.Sprintf(`%s
|
||||
|
||||
Daily Results Summary:
|
||||
- %d Ended Events
|
||||
|
|
@ -549,7 +549,7 @@ All events were processed successfully, and no issues were detected.
|
|||
Best regards,
|
||||
The System`, greeting, counts.StatusEndedCount, totalBets)
|
||||
|
||||
html := fmt.Sprintf(`<p>%s</p>
|
||||
html := fmt.Sprintf(`<p>%s</p>
|
||||
<h2>Daily Results Summary</h2>
|
||||
<ul>
|
||||
<li><strong>%d Ended Events</strong></li>
|
||||
|
|
@ -557,48 +557,48 @@ The System`, greeting, counts.StatusEndedCount, totalBets)
|
|||
</ul>
|
||||
<p>All events were processed successfully, and no issues were detected.</p>
|
||||
<p>Best regards,<br>The System</p>`,
|
||||
greeting, counts.StatusEndedCount, totalBets)
|
||||
greeting, counts.StatusEndedCount, totalBets)
|
||||
|
||||
return headline, plain, html
|
||||
}
|
||||
return headline, plain, html
|
||||
}
|
||||
|
||||
partsPlain := []string{}
|
||||
partsHTML := []string{}
|
||||
partsPlain := []string{}
|
||||
partsHTML := []string{}
|
||||
|
||||
if counts.StatusNotFinishedCount > 0 {
|
||||
partsPlain = append(partsPlain,
|
||||
fmt.Sprintf("- %d Unresolved Events (%d Bets)", counts.StatusNotFinishedCount, counts.StatusNotFinishedBets))
|
||||
partsHTML = append(partsHTML,
|
||||
fmt.Sprintf("<li><strong>%d Unresolved Events</strong> (%d Bets)</li>", counts.StatusNotFinishedCount, counts.StatusNotFinishedBets))
|
||||
}
|
||||
if counts.StatusToBeFixedCount > 0 {
|
||||
partsPlain = append(partsPlain,
|
||||
fmt.Sprintf("- %d Requires Review (%d Bets)", counts.StatusToBeFixedCount, counts.StatusToBeFixedBets))
|
||||
partsHTML = append(partsHTML,
|
||||
fmt.Sprintf("<li><strong>%d Requires Review</strong> (%d Bets)</li>", counts.StatusToBeFixedCount, counts.StatusToBeFixedBets))
|
||||
}
|
||||
if counts.StatusPostponedCount > 0 {
|
||||
partsPlain = append(partsPlain,
|
||||
fmt.Sprintf("- %d Postponed Events (%d Bets)", counts.StatusPostponedCount, counts.StatusPostponedBets))
|
||||
partsHTML = append(partsHTML,
|
||||
fmt.Sprintf("<li><strong>%d Postponed Events</strong> (%d Bets)</li>", counts.StatusPostponedCount, counts.StatusPostponedBets))
|
||||
}
|
||||
if counts.StatusRemovedCount > 0 {
|
||||
partsPlain = append(partsPlain,
|
||||
fmt.Sprintf("- %d Discarded Events (%d Bets)", counts.StatusRemovedCount, counts.StatusRemovedBets))
|
||||
partsHTML = append(partsHTML,
|
||||
fmt.Sprintf("<li><strong>%d Discarded Events</strong> (%d Bets)</li>", counts.StatusRemovedCount, counts.StatusRemovedBets))
|
||||
}
|
||||
if counts.StatusEndedCount > 0 {
|
||||
partsPlain = append(partsPlain,
|
||||
fmt.Sprintf("- %d Successfully Ended Events (%d Bets)", counts.StatusEndedCount, counts.StatusEndedBets))
|
||||
partsHTML = append(partsHTML,
|
||||
fmt.Sprintf("<li><strong>%d Successfully Ended Events</strong> (%d Bets)</li>", counts.StatusEndedCount, counts.StatusEndedBets))
|
||||
}
|
||||
if counts.StatusNotFinishedCount > 0 {
|
||||
partsPlain = append(partsPlain,
|
||||
fmt.Sprintf("- %d Unresolved Events (%d Bets)", counts.StatusNotFinishedCount, counts.StatusNotFinishedBets))
|
||||
partsHTML = append(partsHTML,
|
||||
fmt.Sprintf("<li><strong>%d Unresolved Events</strong> (%d Bets)</li>", counts.StatusNotFinishedCount, counts.StatusNotFinishedBets))
|
||||
}
|
||||
if counts.StatusToBeFixedCount > 0 {
|
||||
partsPlain = append(partsPlain,
|
||||
fmt.Sprintf("- %d Requires Review (%d Bets)", counts.StatusToBeFixedCount, counts.StatusToBeFixedBets))
|
||||
partsHTML = append(partsHTML,
|
||||
fmt.Sprintf("<li><strong>%d Requires Review</strong> (%d Bets)</li>", counts.StatusToBeFixedCount, counts.StatusToBeFixedBets))
|
||||
}
|
||||
if counts.StatusPostponedCount > 0 {
|
||||
partsPlain = append(partsPlain,
|
||||
fmt.Sprintf("- %d Postponed Events (%d Bets)", counts.StatusPostponedCount, counts.StatusPostponedBets))
|
||||
partsHTML = append(partsHTML,
|
||||
fmt.Sprintf("<li><strong>%d Postponed Events</strong> (%d Bets)</li>", counts.StatusPostponedCount, counts.StatusPostponedBets))
|
||||
}
|
||||
if counts.StatusRemovedCount > 0 {
|
||||
partsPlain = append(partsPlain,
|
||||
fmt.Sprintf("- %d Discarded Events (%d Bets)", counts.StatusRemovedCount, counts.StatusRemovedBets))
|
||||
partsHTML = append(partsHTML,
|
||||
fmt.Sprintf("<li><strong>%d Discarded Events</strong> (%d Bets)</li>", counts.StatusRemovedCount, counts.StatusRemovedBets))
|
||||
}
|
||||
if counts.StatusEndedCount > 0 {
|
||||
partsPlain = append(partsPlain,
|
||||
fmt.Sprintf("- %d Successfully Ended Events (%d Bets)", counts.StatusEndedCount, counts.StatusEndedBets))
|
||||
partsHTML = append(partsHTML,
|
||||
fmt.Sprintf("<li><strong>%d Successfully Ended Events</strong> (%d Bets)</li>", counts.StatusEndedCount, counts.StatusEndedBets))
|
||||
}
|
||||
|
||||
headline := "⚠️ Daily Results Report — Review Required"
|
||||
headline := "⚠️ Daily Results Report — Review Required"
|
||||
|
||||
plain := fmt.Sprintf(`%s
|
||||
plain := fmt.Sprintf(`%s
|
||||
|
||||
Daily Results Summary:
|
||||
%s
|
||||
|
|
@ -612,13 +612,13 @@ Some events require your attention. Please log into the admin dashboard to revie
|
|||
|
||||
Best regards,
|
||||
The System`,
|
||||
greeting,
|
||||
strings.Join(partsPlain, "\n"),
|
||||
totalEvents,
|
||||
totalBets,
|
||||
)
|
||||
greeting,
|
||||
strings.Join(partsPlain, "\n"),
|
||||
totalEvents,
|
||||
totalBets,
|
||||
)
|
||||
|
||||
html := fmt.Sprintf(`<p>%s</p>
|
||||
html := fmt.Sprintf(`<p>%s</p>
|
||||
<h2>Daily Results Summary</h2>
|
||||
<ul>
|
||||
%s
|
||||
|
|
@ -628,18 +628,17 @@ The System`,
|
|||
<li><strong>%d Events Processed</strong></li>
|
||||
<li><strong>%d Total Bets</strong></li>
|
||||
</ul>
|
||||
<p><strong>Next Steps:</strong><br>Some events require your attention. Please <a href="https://your-dashboard-url.example">log into the admin dashboard</a> to review pending issues.</p>
|
||||
<p><strong>Next Steps:</strong><br>Some events require your attention. Please <a href="https://admin.fortunebets.net">log into the admin dashboard</a> to review pending issues.</p>
|
||||
<p>Best regards,<br>The System</p>`,
|
||||
greeting,
|
||||
strings.Join(partsHTML, "\n"),
|
||||
totalEvents,
|
||||
totalBets,
|
||||
)
|
||||
greeting,
|
||||
strings.Join(partsHTML, "\n"),
|
||||
totalEvents,
|
||||
totalBets,
|
||||
)
|
||||
|
||||
return headline, plain, html
|
||||
return headline, plain, html
|
||||
}
|
||||
|
||||
|
||||
func (s *Service) SendAdminResultStatusErrorNotification(
|
||||
ctx context.Context,
|
||||
counts domain.ResultLog,
|
||||
|
|
@ -660,7 +659,6 @@ func (s *Service) SendAdminResultStatusErrorNotification(
|
|||
}
|
||||
|
||||
headline, message := buildHeadlineAndMessage(counts)
|
||||
|
||||
|
||||
notification := &domain.Notification{
|
||||
ErrorSeverity: domain.NotificationErrorSeverityHigh,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user