From ae2966f8b5dc9ef2eca21dad397aa545b44cdc85 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Fri, 1 May 2015 17:24:38 +0200 Subject: [PATCH] GetAllBelow => ThisAndBelow --- Logic/Financial/FinancialAccounts.cs | 8 ++++---- Logic/Structure/Geographies.cs | 2 +- Logic/Structure/GeographyStatistics.cs | 6 +++--- Logic/Structure/Organization.cs | 2 +- Logic/Swarm/Activists.cs | 4 ++-- Logic/Swarm/People.cs | 8 ++++---- Site5/Automation/FieldValidation.aspx.cs | 2 +- Site5/Pages/v5/Comms/SendMassMessage.aspx.cs | 4 ++-- Site5/Pages/v5/Ledgers/AccountPlan.aspx.cs | 4 ++-- Utility/BotCode/InternalPollMaintenance.cs | 2 +- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Logic/Financial/FinancialAccounts.cs b/Logic/Financial/FinancialAccounts.cs index 69700faa..bb2c63f4 100644 --- a/Logic/Financial/FinancialAccounts.cs +++ b/Logic/Financial/FinancialAccounts.cs @@ -116,11 +116,11 @@ namespace Swarmops.Logic.Financial } - public static FinancialAccounts GetAllBelow (FinancialAccount rootAccount) + public static FinancialAccounts ThisAndBelow (FinancialAccount rootAccount) { Dictionary 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 accounts, int startNodeId, + private static FinancialAccounts ThisAndBelow (Dictionary 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) { diff --git a/Logic/Structure/Geographies.cs b/Logic/Structure/Geographies.cs index f0eb82ad..ef217cd3 100644 --- a/Logic/Structure/Geographies.cs +++ b/Logic/Structure/Geographies.cs @@ -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 geoTree = Tree.FromCollection(geographies); GuidCache.Set(cacheKey, geoTree); diff --git a/Logic/Structure/GeographyStatistics.cs b/Logic/Structure/GeographyStatistics.cs index 63909302..62018c27 100644 --- a/Logic/Structure/GeographyStatistics.cs +++ b/Logic/Structure/GeographyStatistics.cs @@ -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(); diff --git a/Logic/Structure/Organization.cs b/Logic/Structure/Organization.cs index 9c3ef33e..200e3a14 100644 --- a/Logic/Structure/Organization.cs +++ b/Logic/Structure/Organization.cs @@ -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)); diff --git a/Logic/Swarm/Activists.cs b/Logic/Swarm/Activists.cs index 0bf14a9d..c0ef0e0f 100644 --- a/Logic/Swarm/Activists.cs +++ b/Logic/Swarm/Activists.cs @@ -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)); } diff --git a/Logic/Swarm/People.cs b/Logic/Swarm/People.cs index 9babd6e8..4529cff1 100644 --- a/Logic/Swarm/People.cs +++ b/Logic/Swarm/People.cs @@ -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 diff --git a/Site5/Automation/FieldValidation.aspx.cs b/Site5/Automation/FieldValidation.aspx.cs index 7a34a183..b291e920 100644 --- a/Site5/Automation/FieldValidation.aspx.cs +++ b/Site5/Automation/FieldValidation.aspx.cs @@ -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 diff --git a/Site5/Pages/v5/Comms/SendMassMessage.aspx.cs b/Site5/Pages/v5/Comms/SendMassMessage.aspx.cs index 7c2950f9..145b947f 100644 --- a/Site5/Pages/v5/Comms/SendMassMessage.aspx.cs +++ b/Site5/Pages/v5/Comms/SendMassMessage.aspx.cs @@ -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) { diff --git a/Site5/Pages/v5/Ledgers/AccountPlan.aspx.cs b/Site5/Pages/v5/Ledgers/AccountPlan.aspx.cs index b4d526fa..70ddd5da 100644 --- a/Site5/Pages/v5/Ledgers/AccountPlan.aspx.cs +++ b/Site5/Pages/v5/Ledgers/AccountPlan.aspx.cs @@ -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; diff --git a/Utility/BotCode/InternalPollMaintenance.cs b/Utility/BotCode/InternalPollMaintenance.cs index 9f1a1abc..884542e5 100644 --- a/Utility/BotCode/InternalPollMaintenance.cs +++ b/Utility/BotCode/InternalPollMaintenance.cs @@ -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);