Comparisons (synastry) of the own chart and persons
/osszevetesek compares any two of the user's charts (own and persons); the person card and the person's chart page have "Összevetés velem". The comparison page shows a double wheel (first person inside with houses, second outside, aspects between them), the aspects by character, and tabs: paid relationship analysis (synastry unit), the cross aspect grid, house overlays, composite and the full aspect list. Correcting a person within the hour now deletes the user's own comparisons with them instead of being refused; still refused after a paid analysis or when someone else's comparison uses the chart. The relationship analysis prompt is editable on /admin/promptok too, and can be tried on one of the admin's comparisons. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -273,8 +273,9 @@ pub async fn update(
|
||||
};
|
||||
let mut tx = state.db.begin().await?;
|
||||
if let Some((birth, result, hash)) = &recalculated {
|
||||
// The old summary (and an admin's analyses) no longer match the chart.
|
||||
// The old summary, the comparisons (and an admin's analyses) no longer match the chart.
|
||||
sqlx::query("DELETE FROM analyses WHERE chart_id = $1").bind(id).execute(&mut *tx).await?;
|
||||
sqlx::query("DELETE FROM synastries WHERE chart1_id = $1 OR chart2_id = $1").bind(id).execute(&mut *tx).await?;
|
||||
sqlx::query("UPDATE charts SET birth_data = $1, result = $2, chart_hash = $3 WHERE id = $4")
|
||||
.bind(birth)
|
||||
.bind(result)
|
||||
@@ -322,11 +323,16 @@ async fn corrected_birth(
|
||||
return Err(ApiError::conflict("person_locked", persons::LOCKED_MESSAGE));
|
||||
}
|
||||
let admin = auth.user.has_role(db::Role::Admin);
|
||||
let (analysed, in_synastry): (bool, bool) = sqlx::query_as(
|
||||
"SELECT EXISTS (SELECT 1 FROM analyses WHERE chart_id = $1 AND kind <> 'summary' AND status <> 'failed'), \
|
||||
EXISTS (SELECT 1 FROM synastries WHERE chart1_id = $1 OR chart2_id = $1)",
|
||||
// The user's own comparisons with the person are deleted on correction (they
|
||||
// no longer match), unless a paid analysis was written for one of them.
|
||||
let (analysed, foreign_synastry): (bool, bool) = sqlx::query_as(
|
||||
"SELECT EXISTS (SELECT 1 FROM analyses WHERE chart_id = $1 AND kind <> 'summary' AND status <> 'failed') \
|
||||
OR EXISTS (SELECT 1 FROM analyses a JOIN synastries s ON s.id = a.synastry_id \
|
||||
WHERE (s.chart1_id = $1 OR s.chart2_id = $1) AND a.status <> 'failed'), \
|
||||
EXISTS (SELECT 1 FROM synastries WHERE (chart1_id = $1 OR chart2_id = $1) AND owner_id <> $2)",
|
||||
)
|
||||
.bind(chart.id)
|
||||
.bind(auth.id())
|
||||
.fetch_one(&state.db)
|
||||
.await?;
|
||||
if analysed && !admin {
|
||||
@@ -335,10 +341,10 @@ async fn corrected_birth(
|
||||
"Ehhez a személyhez már készült részletes elemzés, ezért az adatai nem módosíthatók.",
|
||||
));
|
||||
}
|
||||
if in_synastry {
|
||||
if foreign_synastry {
|
||||
return Err(ApiError::conflict(
|
||||
"person_in_synastry",
|
||||
"A személy szerepel egy összevetésben, ezért az adatai nem módosíthatók.",
|
||||
"A személy szerepel valaki más összevetésében, ezért az adatai nem módosíthatók.",
|
||||
));
|
||||
}
|
||||
calculate(state, birth).await
|
||||
|
||||
Reference in New Issue
Block a user