Proca.Server.Stats (proca v3.4.1)
Stores campaign and action page signature counts in following structure (under campaign state key):
- map of campaign ids stores a following structure:
- supporters - how many deduplicated supporters in total (including
extra_supporters
) - action - action counts grouped by action type
- area - supporters grouped by area
- org - supporters grouped by org name
- supporters - how many deduplicated supporters in total (including
extra_supporters are not included in action counts, nor in area counts (we do not know where they belong).
Process state structure:
interval
: int - calculation interval in msquery_runs
: boolean - a flag saying calculation is running now and we shouldn't run new calculationcampaign
:campaign_id -> %Stats{}
(map)
Link to this section Summary
Functions
Run the full calculation of stats
Returns a specification to start this module under a supervisor.
- Get stats for campaign
- Get stats for action types
Every @sync_every_ms ms we send to ourselves a :sync message, to synchronize counts from DB.
Increment by one action count for particular action_type
collected by org with org_id
, in campaign with campaign_id
.
The new_supporter
is true if addActionContact
was used to create action + supporter, otherwise a supporter was re-used (addAction
).
Same as increment/4 but provides area
Get stats for this campaign_id
from Stat process.
Link to this section Functions
calculate()
Run the full calculation of stats
child_spec(init_arg)
Returns a specification to start this module under a supervisor.
See Supervisor
.
handle_call(msg, arg2, state)
- Get stats for campaign
- Get stats for action types
handle_info(msg, state)
Every @sync_every_ms ms we send to ourselves a :sync message, to synchronize counts from DB.
increment(campaign_id, org_id, action_type, new_supporter)
Increment by one action count for particular action_type
collected by org with org_id
, in campaign with campaign_id
.
The new_supporter
is true if addActionContact
was used to create action + supporter, otherwise a supporter was re-used (addAction
).
increment(campaign_id, org_id, action_type, area, new_supporter)
Same as increment/4 but provides area
start_link(args)
stats(campaign_id)
Get stats for this campaign_id
from Stat process.