feat: 抽测风速改为用户可自定义次数(增删按钮)
- models.rs:新增 spot_check_count 字段(默认 5) - db.rs:INSERT/SELECT 添加 spotcheckcount 列 - migrations/007:ALTER TABLE weather_data ADD spotcheckcount - afterbody.js:使用 data.spotCheckCount 动态渲染抽测数据
This commit is contained in:
@@ -35,10 +35,10 @@ pub async fn insert_weather_data(pool: &PgPool, weather_data: &WeatherData, user
|
||||
atmosphericstability, suitabilitydegree, winddirection, averagewinddirection,
|
||||
winddirectionstandarddeviation, windspeed, averagewindspeed, windspeedsuitability,
|
||||
winddirectionsuitability, overallsuitability, inspectiontype, assignmentnumber,
|
||||
calculatedwindspeed, hasspotcheckwindspeed, version, is_favorite
|
||||
calculatedwindspeed, hasspotcheckwindspeed, spotcheckcount, version, is_favorite
|
||||
) VALUES (
|
||||
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19,
|
||||
$20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36, $37
|
||||
$20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36, $37, $38
|
||||
) RETURNING id
|
||||
"#;
|
||||
|
||||
@@ -85,6 +85,7 @@ pub async fn insert_weather_data(pool: &PgPool, weather_data: &WeatherData, user
|
||||
.bind(&weather_data.assignment_number)
|
||||
.bind(weather_data.calculated_wind_speed) // 这个本来就是 Option,无需修改
|
||||
.bind(weather_data.has_spot_check_wind_speed)
|
||||
.bind(weather_data.spot_check_count)
|
||||
.bind(&weather_data.version)
|
||||
.bind(weather_data.is_favorite)
|
||||
.fetch_one(pool)
|
||||
@@ -131,7 +132,7 @@ pub async fn get_weather_details(pool: &PgPool, weather_id: i32) -> Result<Weath
|
||||
wd.winddirectionstandarddeviation, wd.windspeed, wd.averagewindspeed,
|
||||
wd.windspeedsuitability, wd.winddirectionsuitability, wd.overallsuitability,
|
||||
wd.inspectiontype, wd.assignmentnumber, wd.calculatedwindspeed, wd.hasspotcheckwindspeed,
|
||||
wd.is_favorite, u.openid, wd.version
|
||||
wd.spotcheckcount, wd.is_favorite, u.openid, wd.version
|
||||
FROM weather_data wd
|
||||
JOIN users u ON wd.user_id = u.id
|
||||
WHERE wd.id = $1
|
||||
|
||||
Reference in New Issue
Block a user