GetAllBelow => ThisAndBelow
This commit is contained in:
@@ -116,11 +116,11 @@ namespace Swarmops.Logic.Financial
|
||||
}
|
||||
|
||||
|
||||
public static FinancialAccounts GetAllBelow (FinancialAccount rootAccount)
|
||||
public static FinancialAccounts ThisAndBelow (FinancialAccount rootAccount)
|
||||
{
|
||||
Dictionary<int, FinancialAccounts> nodes = GetHashedAccounts (rootAccount.Organization);
|
||||
|
||||
return GetAllBelow (nodes, rootAccount.Identity, 0);
|
||||
return ThisAndBelow (nodes, rootAccount.Identity, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace Swarmops.Logic.Financial
|
||||
}*/
|
||||
|
||||
|
||||
private static FinancialAccounts GetAllBelow (Dictionary<int, FinancialAccounts> accounts, int startNodeId,
|
||||
private static FinancialAccounts ThisAndBelow (Dictionary<int, FinancialAccounts> accounts, int startNodeId,
|
||||
int generation)
|
||||
{
|
||||
FinancialAccounts result = new FinancialAccounts();
|
||||
@@ -155,7 +155,7 @@ namespace Swarmops.Logic.Financial
|
||||
|
||||
// Add recursively
|
||||
|
||||
FinancialAccounts children = GetAllBelow (accounts, account.Identity, generation + 1);
|
||||
FinancialAccounts children = ThisAndBelow (accounts, account.Identity, generation + 1);
|
||||
|
||||
if (children.Count > 0)
|
||||
{
|
||||
|
||||
@@ -278,7 +278,7 @@ namespace Swarmops.Logic.Structure
|
||||
object testObject = GuidCache.Get(cacheKey);
|
||||
if (testObject == null)
|
||||
{
|
||||
Geographies geographies = Geography.Root.GetAllBelow();
|
||||
Geographies geographies = Geography.Root.ThisAndBelow();
|
||||
Tree<Geography> geoTree = Tree<Geography>.FromCollection(geographies);
|
||||
|
||||
GuidCache.Set(cacheKey, geoTree);
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Swarmops.Logic.Structure
|
||||
{
|
||||
People members =
|
||||
People.FromMemberships (
|
||||
Memberships.ForOrganizations (Organization.FromIdentity (orgId).GetAllBelow()));
|
||||
Memberships.ForOrganizations (Organization.FromIdentity (orgId).ThisAndBelow()));
|
||||
|
||||
foreach (Person person in members)
|
||||
{
|
||||
@@ -88,11 +88,11 @@ namespace Swarmops.Logic.Structure
|
||||
|
||||
// Step 3 - add up the totals for every intermediate node (expensive!)
|
||||
|
||||
Geographies allGeographies = Geography.Root.GetAllBelow();
|
||||
Geographies allGeographies = Geography.Root.ThisAndBelow();
|
||||
|
||||
foreach (Geography geography in allGeographies)
|
||||
{
|
||||
Geographies localTree = geography.GetAllBelow();
|
||||
Geographies localTree = geography.ThisAndBelow();
|
||||
int voterCount = 0;
|
||||
GeographyOrganizationDataPoint[] tempOrgData = new GeographyOrganizationDataPoint[2]; // HACK
|
||||
tempOrgData[0] = new GeographyOrganizationDataPoint();
|
||||
|
||||
@@ -420,7 +420,7 @@ namespace Swarmops.Logic.Structure
|
||||
//return Organizations.FromArray(SwarmDb.GetDatabaseForReading().GetOrganizationLine(Identity));
|
||||
}
|
||||
|
||||
public Organizations GetAllBelow()
|
||||
public Organizations ThisAndBelow()
|
||||
{
|
||||
return Organizations.FromArray (OrganizationCache.GetOrganizationTree (Identity));
|
||||
//return Organizations.FromArray(SwarmDb.GetDatabaseForReading().GetOrganizationTree(Identity));
|
||||
|
||||
@@ -41,14 +41,14 @@ namespace Swarmops.Logic.Swarm
|
||||
|
||||
public static int GetCountForGeography (Geography geography)
|
||||
{
|
||||
Geographies geographies = geography.GetAllBelow();
|
||||
Geographies geographies = geography.ThisAndBelow();
|
||||
|
||||
return SwarmDb.GetDatabaseForReading().GetActivistCountForGeographies (geographies.Identities);
|
||||
}
|
||||
|
||||
public static Activists FromGeography (Geography geography)
|
||||
{
|
||||
Geographies geographies = geography.GetAllBelow();
|
||||
Geographies geographies = geography.ThisAndBelow();
|
||||
return new Activists (SwarmDb.GetDatabaseForReading().GetActivistPersonIds (geographies.Identities));
|
||||
}
|
||||
|
||||
|
||||
@@ -257,7 +257,7 @@ namespace Swarmops.Logic.Swarm
|
||||
public static People FromOrganizationAndGeographyWithPattern (Organization organization, Geography geography,
|
||||
string pattern)
|
||||
{
|
||||
Geographies geoTree = geography.GetAllBelow();
|
||||
Geographies geoTree = geography.ThisAndBelow();
|
||||
|
||||
pattern = pattern.Trim();
|
||||
if (pattern.Length == 0)
|
||||
@@ -281,7 +281,7 @@ namespace Swarmops.Logic.Swarm
|
||||
|
||||
public static People FromOrganizationAndGeography (Organization organization, Geography geography)
|
||||
{
|
||||
Geographies geoTree = geography.GetAllBelow();
|
||||
Geographies geoTree = geography.ThisAndBelow();
|
||||
|
||||
// First, get list of people in the geography, then filter on memberships
|
||||
|
||||
@@ -297,7 +297,7 @@ namespace Swarmops.Logic.Swarm
|
||||
{
|
||||
// Get the organization tree
|
||||
|
||||
Organizations orgTree = organization.GetAllBelow();
|
||||
Organizations orgTree = organization.ThisAndBelow();
|
||||
|
||||
// Build a lookup table of this organization tree. For each person in 'people'
|
||||
// that has at least one membership in an organization in the lookup table,
|
||||
@@ -344,7 +344,7 @@ namespace Swarmops.Logic.Swarm
|
||||
|
||||
public static People FromGeography (int geographyId)
|
||||
{
|
||||
Geographies geoTree = Geography.FromIdentity (geographyId).GetAllBelow();
|
||||
Geographies geoTree = Geography.FromIdentity (geographyId).ThisAndBelow();
|
||||
|
||||
// First, get list of people in the geography, then filter on memberships
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace Swarmops.Frontend.Automation
|
||||
cityArray.Add (dataPoint);
|
||||
}
|
||||
|
||||
Geographies geographies = Country.FromCode (countryCode).Geography.GetAllBelow();
|
||||
Geographies geographies = Country.FromCode (countryCode).Geography.ThisAndBelow();
|
||||
foreach (Geography geography in geographies)
|
||||
{
|
||||
GeographyData dataPoint = new GeographyData
|
||||
|
||||
@@ -53,8 +53,8 @@ namespace Swarmops.Frontend.Pages.Comms
|
||||
|
||||
AuthenticationData authData = GetAuthenticationDataAndCulture();
|
||||
Geography geography = Geography.FromIdentity (geographyId);
|
||||
Geographies geoTree = geography.GetAllBelow();
|
||||
Organizations orgTree = authData.CurrentOrganization.GetAllBelow();
|
||||
Geographies geoTree = geography.ThisAndBelow();
|
||||
Organizations orgTree = authData.CurrentOrganization.ThisAndBelow();
|
||||
|
||||
switch (recipientTypeId)
|
||||
{
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
throw new UnauthorizedAccessException ("A million nopes");
|
||||
}
|
||||
|
||||
FinancialAccounts accountTree = account.GetAllBelow();
|
||||
FinancialAccounts accountTree = account.ThisAndBelow();
|
||||
int year = DateTime.Today.Year;
|
||||
|
||||
JsonAccountData result = new JsonAccountData();
|
||||
@@ -380,7 +380,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
newTreeBudget *= 100; // convert to cents
|
||||
|
||||
int year = DateTime.Today.Year;
|
||||
FinancialAccounts accountTree = account.GetAllBelow();
|
||||
FinancialAccounts accountTree = account.ThisAndBelow();
|
||||
Int64 currentTreeBudget = accountTree.GetBudgetSumCents (year);
|
||||
Int64 currentSingleBudget = account.GetBudgetCents (year);
|
||||
Int64 suballocatedBudget = currentTreeBudget - currentSingleBudget;
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Swarmops.Utility.BotCode
|
||||
|
||||
// Populate voters, then open for voting
|
||||
|
||||
Organizations orgTree = poll.Organization.GetAllBelow();
|
||||
Organizations orgTree = poll.Organization.ThisAndBelow();
|
||||
|
||||
Memberships memberships = Memberships.ForOrganizations (orgTree);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user