Changed some hardcoded organization name tests to proper installation ID tests. (Still special treatment for specific installations, but that's what you get with pilots who take the pain of betaing.)

This commit is contained in:
Rick Falkvinge
2014-08-26 11:51:19 +00:00
parent 115c665aaa
commit 02475a5584
5 changed files with 20 additions and 6 deletions
+2 -1
View File
@@ -5,6 +5,7 @@ using System.IO;
using System.Linq;
using System.Text;
using Swarmops.Logic.Structure;
using Swarmops.Logic.Support;
namespace Swarmops.Logic.Financial
{
@@ -174,7 +175,7 @@ namespace Swarmops.Logic.Financial
// PILOT SPECIAL CASE: if Paypal and PPSE Pilot program, ignore everything before 2014
if (dateTime.Year < 2014 && organization.Identity == 1 && fieldNameLookup.ContainsKey(ExternalBankDataFieldName.UniqueId) && organization.Name == "Piratpartiet SE")
if (dateTime.Year < 2014 && organization.Identity == 1 && fieldNameLookup.ContainsKey(ExternalBankDataFieldName.UniqueId) && PilotInstallationIds.IsPilot (PilotInstallationIds.PiratePartySE))
{
continue; // Do not import PayPal records from before 2013
}
+1 -1
View File
@@ -801,7 +801,7 @@ namespace Swarmops.Logic.Structure
// HACK: MUST FETCH THIS FROM ACTUAL ACCOUNTS
// HACK HACK HACK HACK HACK HACK
if (Organization.FromIdentity(1).Name == "Piratpartiet SE") // also, fetch that from installation id instead
if (PilotInstallationIds.IsPilot(PilotInstallationIds.PiratePartySE) && this.OrganizationId == 1)
{
FinancialAccounts result = new FinancialAccounts();
result.Add(FinancialAccount.FromIdentity(1));
+13
View File
@@ -9,5 +9,18 @@ namespace Swarmops.Logic.Support
{
static public string PiratePartySE
{ get { return "d7588903-5fd0-40cf-a5b1-9af7a722cb6e"; } }
static public bool IsPilot(string installationId)
{
string thisInstallationId = Persistence.Key["SwarmopsInstallationId"];
if (installationId == thisInstallationId)
{
return true;
}
return false;
}
}
}
@@ -562,13 +562,13 @@ namespace Swarmops.Site.Pages.Ledgers
amountCents = row.TransactionGrossCents;
}
if (args.Organization.Identity == 1 && assetAccount.Identity == 1 && args.Organization.Name == "Piratpartiet SE")
if (args.Organization.Identity == 1 && assetAccount.Identity == 1 && PilotInstallationIds.IsPilot(PilotInstallationIds.PiratePartySE))
{
// TODO: Change to "installation id" parameter
// This is an ugly-as-fuck hack that sorts under the category "just bring our pilots the fuck back to operational
// status right fucking now".
// This code can and should be safely removed once the pilot's books are closed for 2014, which should be some time mid-2015.
if (row.DateTime < new DateTime(2014,03,22))
{
result.DuplicateTransactions++;
+1 -1
View File
@@ -694,7 +694,7 @@ namespace Swarmops.Utility.BotCode
[Obsolete ("Use LostMember instead.", true)]
internal static void ProcessTerminatedMembership (BasicPWEvent newPwEvent)
{
//OBSOLETE LostMember is used instead.