airqo-platform / airqo-platform/AirQo-api

Fix: Pass preferences parameter to generateAlertEmailContent in air-quality-alerts-job

未關閉
#4,206 0 則留言 0 個 reaction 已指派 1 人 已被 @Baalmart 認領 在 GitHub 檢視
主要語言
JavaScript
星號
26
分支
24
平均合併
5 小時 36 分鐘
30 天內合併 PR
81

描述

## Issue Description

The `generateAlertEmailContent` function in `src/auth-service/bin/jobs/air-quality-alerts-job.js` expects three parameters: `spikes`, `userName`, and `preferences`. However, in the current implementation, only two arguments are being passed when calling this function, which could lead to runtime errors when the function tries to access the `preferences` parameter.

### Current Implementation
```javascript
const emailPromises = batch.map(async ({ user, spikes }) => {
const content = generateAlertEmailContent(spikes, user.firstName);
```

### Expected Implementation
```javascript
const emailPromises = batch.map(async ({ user, spikes, preferences }) => {
const content = generateAlertEmailContent(spikes, user.firstName, preferences);
```

### Impact
- Potential runtime errors when accessing preferences data
- Incorrect threshold values in email alerts
- Missing site-specific preferences in the generated email content

### References
- Pull Request: https://github.com/airqo-platform/AirQo-api/pull/4204
- Discussion: https://github.com/airqo-platform/AirQo-api/pull/4204#discussion_r1921239185

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。