Class StatsService
Inheritance
Implements
Namespace: DirectScale.Disco.Extension.Services
Assembly: DirectScale.Disco.Extension.Abstractions.dll
Syntax
public class StatsService : Object, IStatsService
Constructors
StatsService(IApiService)
Declaration
public StatsService(IApiService apiService)
Parameters
Type | Name | Description |
---|---|---|
IApiService | apiService |
Methods
GetStats(Int32[], DateTime)
Gets all the stats for associateIDs
for the period containing date
.
Declaration
public Task<Dictionary<int, CommissionStats>> GetStats(int[] associateIDs, DateTime date)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | associateIDs | These are the associates to get the stats for. |
System.DateTime | date | The stats are retrieved for the commission period containing this date. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<System.Int32, CommissionStats>> | A dictionary of Key: AssociateId Value: stats for all |
Remarks
Only commission values found in the stats template will be returned. For example, it is common to have a main monthly template and a weekly template. In this case, only values defined in the monthly template will be returned, none from the weekly template.
See Also
ProcessStatsQueue()
Triggers a stats run to pick up any queued items, such as orders placed. If stats is already running, it will schedule another run as soon as the current process finished.
Declaration
public Task ProcessStatsQueue()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Remarks
Calling this method is uncommon since most ways to modify volume will trigger a stats run already.
RecalculateVolume(VolumeSource)
Adds an associate to the stats queue to recalculate their volume, then triggers a stats run to begin ProcessStatsQueue().
Declaration
public Task RecalculateVolume(VolumeSource volumeSource)
Parameters
Type | Name | Description |
---|---|---|
VolumeSource | volumeSource | The associate information to queue. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Remarks
Each time stats run, only those associates who have had volume changes in their downline will be processed. This method will manually add associates to be processed, which can be useful when troubleshooting if someone's stats look incorrect. Creating a custom endpoint to call this method would be useful for that purpose