Refactor trigger creation logic: Update the created_at and updated_at fields to use the election date instead of the current timestamp, ensuring accurate term end calculations. Enhance socket event handling in StatusBar component by implementing setup and teardown methods for improved event management and user notifications.
This commit is contained in:
@@ -350,15 +350,16 @@ export async function createTriggers() {
|
||||
SELECT * FROM random_fill
|
||||
),
|
||||
|
||||
-- 8) Neue Ämter anlegen und sofort zurückliefern
|
||||
-- 8) Neue Ämter anlegen – created_at = Wahldatum (Amtsbeginn), nicht NOW()
|
||||
-- damit termEnds = Amtsbeginn + termLength korrekt berechnet werden kann
|
||||
created_offices AS (
|
||||
INSERT INTO falukant_data.political_office
|
||||
(office_type_id, character_id, created_at, updated_at, region_id)
|
||||
SELECT
|
||||
tp.tp_office_type_id,
|
||||
fw.character_id,
|
||||
NOW() AS created_at,
|
||||
NOW() AS updated_at,
|
||||
tp.tp_election_date AS created_at,
|
||||
tp.tp_election_date AS updated_at,
|
||||
tp.tp_region_id
|
||||
FROM final_winners fw
|
||||
JOIN to_process tp
|
||||
|
||||
@@ -3535,8 +3535,9 @@ class FalukantService extends BaseService {
|
||||
firstName: firstNameObject.id,
|
||||
});
|
||||
updateFalukantUserMoney(falukantUser.id, -50, 'Baptism', falukantUser.id);
|
||||
// Trigger status bar refresh for the user after baptism
|
||||
notifyUser(hashedUserId, 'falukantUpdateStatus', {});
|
||||
// Trigger status bar refresh (children count) and family view update
|
||||
await notifyUser(hashedUserId, 'falukantUpdateStatus', {});
|
||||
await notifyUser(hashedUserId, 'familychanged', {});
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
throw new Error(error.message);
|
||||
|
||||
Reference in New Issue
Block a user