GetAllBelow => ThisAndBelow

This commit is contained in:
Rick Falkvinge
2015-05-01 17:24:38 +02:00
parent ed3d33064e
commit ae2966f8b5
10 changed files with 21 additions and 21 deletions
+4 -4
View File
@@ -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)
{
+1 -1
View File
@@ -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);
+3 -3
View File
@@ -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();
+1 -1
View File
@@ -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));
+2 -2
View File
@@ -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));
}
+4 -4
View File
@@ -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