Yearly forecast: solar return, transits, progressions, profection, eclipses
CI / test (push) Successful in 56s
CI / build (push) Successful in 4m41s
CI / deploy (push) Skipped

- astro-engine: forecast module (solar return moment, slow-planet transits
  with exact dates and periods, natal house ingresses, secondary
  progressions, annual profection, eclipses via Swiss Ephemeris)
- horoscope-api: POST /v1/forecast, solar return chart cast for the place
  of the birthday
- backend: forecasts table, /v1/charts/{id}/forecasts, /v1/forecasts/{id}
  and its analyses using a new 'forecast' unit; current year of life open,
  the next one 30 days before the birthday
- packages: Páros and Család include forecasts (6 000 / 11 000 Ft),
  +1 éves előrejelzés add-on 2 500 Ft; Egy elemzés unchanged
- worker and prompt: forecast kind with five sections and forecast rules
  (trends, no event predictions); no birth data, place or exact age sent
- frontend: /kepletek/{id}/elorejelzes with the solar return wheel, the
  keys of the year, a monthly timeline, transit list and detailed forecast
- data export: forecasts added, model name removed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-18 08:19:13 +00:00
co-authored by Claude Opus 5.5
parent 829c33e52f
commit f1bd34c394
42 changed files with 4764 additions and 85 deletions
+42 -11
View File
@@ -16,6 +16,8 @@ use crate::error::ApiError;
/// List prices of the single items, for showing what a package saves.
const NATAL_PRICE: i64 = 2_000;
const SYNASTRY_PRICE: i64 = 2_500;
/// A yearly forecast bought alone costs more than one in a package.
const FORECAST_PRICE: i64 = 2_500;
const PERSON_PRICE: i64 = 300; // 1 500 Ft for five
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -36,12 +38,13 @@ pub struct Package {
pub price_huf: i64,
pub natal: i64,
pub synastry: i64,
pub forecast: i64,
pub persons: i64,
/// Badge on the card ("Legnépszerűbb").
pub badge: Option<&'static str>,
}
pub const CATALOG: [Package; 5] = [
pub const CATALOG: [Package; 6] = [
Package {
id: "single",
name: "Egy elemzés",
@@ -50,28 +53,31 @@ pub const CATALOG: [Package; 5] = [
price_huf: 2_000,
natal: 1,
synastry: 0,
forecast: 0,
persons: 0,
badge: None,
},
Package {
id: "couple",
name: "Páros",
tagline: "Te és ő: mindkettőtök képlete és a kapcsolati elemzés.",
tagline: "Te és ő: mindkettőtök képlete, éves előrejelzése és a kapcsolati elemzés.",
tier: Tier::Main,
price_huf: 4_500,
price_huf: 6_000,
natal: 2,
synastry: 1,
forecast: 2,
persons: 1,
badge: None,
},
Package {
id: "family",
name: "Család",
tagline: "Az egész család: öt személy, mindenki képlete, és öt kapcsolat.",
tagline: "Az egész család: öt személy, mindenki képlete és éves előrejelzése, és öt kapcsolat.",
tier: Tier::Main,
price_huf: 8_000,
price_huf: 11_000,
natal: 6,
synastry: 5,
forecast: 6,
persons: 5,
badge: Some("Legnépszerűbb"),
},
@@ -83,6 +89,19 @@ pub const CATALOG: [Package; 5] = [
price_huf: 2_500,
natal: 0,
synastry: 1,
forecast: 0,
persons: 0,
badge: None,
},
Package {
id: "addon_forecast",
name: "+1 éves előrejelzés",
tagline: "Egy év születésnaptól születésnapig: szolár, tranzitok, progresszió.",
tier: Tier::Addon,
price_huf: FORECAST_PRICE,
natal: 0,
synastry: 0,
forecast: 1,
persons: 0,
badge: None,
},
@@ -94,6 +113,7 @@ pub const CATALOG: [Package; 5] = [
price_huf: 1_500,
natal: 0,
synastry: 0,
forecast: 0,
persons: 5,
badge: None,
},
@@ -106,11 +126,14 @@ pub fn find(id: &str) -> Option<&'static Package> {
impl Package {
/// What the contents would cost one by one.
fn list_price(&self) -> i64 {
self.natal * NATAL_PRICE + self.synastry * SYNASTRY_PRICE + self.persons * PERSON_PRICE
self.natal * NATAL_PRICE
+ self.synastry * SYNASTRY_PRICE
+ self.forecast * FORECAST_PRICE
+ self.persons * PERSON_PRICE
}
pub fn view(&self) -> Value {
let analyses = self.natal + self.synastry;
let analyses = self.natal + self.synastry + self.forecast;
let list = self.list_price();
let savings = (list > self.price_huf).then(|| ((list - self.price_huf) * 100 + list / 2) / list);
json!({
@@ -121,6 +144,7 @@ impl Package {
"price_huf": self.price_huf,
"natal": self.natal,
"synastry": self.synastry,
"forecast": self.forecast,
"persons": self.persons,
"badge": self.badge,
"list_price_huf": list,
@@ -173,8 +197,13 @@ pub async fn grant(
.bind(created_by)
.execute(&mut *tx)
.await?;
for (unit, n) in [(Unit::Natal, package.natal), (Unit::Synastry, package.synastry), (Unit::Person, package.persons)]
{
let contents = [
(Unit::Natal, package.natal),
(Unit::Synastry, package.synastry),
(Unit::Forecast, package.forecast),
(Unit::Person, package.persons),
];
for (unit, n) in contents {
if n == 0 {
continue;
}
@@ -218,8 +247,10 @@ mod tests {
fn bigger_packages_are_cheaper_per_analysis() {
let per = |id: &str| find(id).unwrap().view()["per_analysis_huf"].as_i64().unwrap();
assert!(per("single") > per("couple") && per("couple") > per("family"));
assert_eq!(find("family").unwrap().view()["savings_percent"], 69);
assert_eq!(find("couple").unwrap().view()["savings_percent"], 34);
assert_eq!(find("family").unwrap().view()["savings_percent"], 73);
assert_eq!(find("couple").unwrap().view()["savings_percent"], 49);
// Alone a forecast costs more than a natal analysis.
assert!(find("addon_forecast").unwrap().price_huf > find("single").unwrap().price_huf);
assert!(find("single").unwrap().view()["savings_percent"].is_null());
assert!(find("unlimited").is_none());
assert!(CATALOG.iter().all(|p| find(p.id).is_some()));