Quincunx in the default aspects, sign-based moon phases, backend recalculate command
- AspectSet::Standard (default): the major aspects and the quincunx; forecasts use it too - Moon phase: new, quarter and full moon only within 12° and in the matching signs - backend recalculate: recalculates stored charts, comparisons and forecasts, then queues every analysis again (nobody is charged) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -108,6 +108,23 @@ fn without(value: &Value, keys: &[&str]) -> Value {
|
||||
Value::Object(map)
|
||||
}
|
||||
|
||||
/// The comparison of two stored charts as stored: `(result, synastry_hash)`.
|
||||
pub(super) async fn calculate(
|
||||
state: &AppState,
|
||||
chart1: &ChartRow,
|
||||
chart2: &ChartRow,
|
||||
) -> Result<(Value, String), ApiError> {
|
||||
let request = json!({
|
||||
"person1": without(&chart1.birth_data, &["options"]),
|
||||
"person2": without(&chart2.birth_data, &["options"]),
|
||||
"options": chart1.birth_data.get("options").cloned().unwrap_or_else(|| json!({})),
|
||||
});
|
||||
let response = state.horoscope.synastry(&request).await?;
|
||||
let result = without(&response, &["person1", "person2", "meta"]);
|
||||
let hash = synastry_hash(&chart1.chart_hash, &chart2.chart_hash, &result["settings"]);
|
||||
Ok((result, hash))
|
||||
}
|
||||
|
||||
/// Returns the synastry of the two charts, calculating and storing it when
|
||||
/// it does not exist yet (in either order). `bool` = newly created.
|
||||
pub async fn compute_synastry(
|
||||
@@ -130,14 +147,7 @@ pub async fn compute_synastry(
|
||||
return Ok((row, false));
|
||||
}
|
||||
|
||||
let request = json!({
|
||||
"person1": without(&chart1.birth_data, &["options"]),
|
||||
"person2": without(&chart2.birth_data, &["options"]),
|
||||
"options": chart1.birth_data.get("options").cloned().unwrap_or_else(|| json!({})),
|
||||
});
|
||||
let response = state.horoscope.synastry(&request).await?;
|
||||
let result = without(&response, &["person1", "person2", "meta"]);
|
||||
let hash = synastry_hash(&chart1.chart_hash, &chart2.chart_hash, &result["settings"]);
|
||||
let (result, hash) = calculate(state, chart1, chart2).await?;
|
||||
|
||||
let inserted: Option<SynastryRow> = sqlx::query_as(&format!(
|
||||
"INSERT INTO synastries (id, owner_id, chart1_id, chart2_id, result, synastry_hash) \
|
||||
|
||||
Reference in New Issue
Block a user