v1.0.42 #54

Merged
timi merged 2 commits from dev into master 2026-09-11 16:16:04 +00:00
Showing only changes of commit eabb4c6aa6 - Show all commits
@@ -348,10 +348,23 @@
FROM `daily_stat` d FROM `daily_stat` d
JOIN `open_calendar` o ON d.`registeredDateValue` = o.`dateValue` JOIN `open_calendar` o ON d.`registeredDateValue` = o.`dateValue`
), ),
`customer_stat` AS (
SELECT
d.`customerId`,
MAX(CASE WHEN d.`registeredDateValue` = #{todayDateValue} THEN 1 ELSE 0 END) AS `hasToday`
FROM `daily_stat` d
GROUP BY d.`customerId`
),
`anchor_date` AS ( `anchor_date` AS (
SELECT SELECT
MAX(`openIndex`) AS `anchorOpenIndex` s.`customerId`,
FROM `open_calendar` CASE
WHEN s.`hasToday` = 1 THEN MAX(CASE WHEN c.`dateValue` = #{todayDateValue} THEN c.`openIndex` END)
ELSE MAX(CASE WHEN c.`dateValue` < #{todayDateValue} THEN c.`openIndex` END)
END AS `anchorOpenIndex`
FROM `customer_stat` s
CROSS JOIN `open_calendar` c
GROUP BY s.`customerId`, s.`hasToday`
), ),
`continuous_stat` AS ( `continuous_stat` AS (
SELECT SELECT
@@ -361,7 +374,7 @@
ELSE COUNT(1) ELSE COUNT(1)
END AS `recentContinuousEventDays` END AS `recentContinuousEventDays`
FROM `continuous_ordered` o FROM `continuous_ordered` o
JOIN `anchor_date` a JOIN `anchor_date` a ON o.`customerId` = a.`customerId`
WHERE WHERE
o.`openIndex` + o.`dayIndex` = a.`anchorOpenIndex` + 1 o.`openIndex` + o.`dayIndex` = a.`anchorOpenIndex` + 1
<if test="eventIdList == null or eventIdList.size() != 1"> <if test="eventIdList == null or eventIdList.size() != 1">