From c4b8756a694ef5f8fbeee12079b285bbec2431b7 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Wed, 10 May 2017 09:53:59 +0200 Subject: [PATCH] More fixes for live data --- FrontSocket/FrontendServices.cs | 1 + Site/App_GlobalResources/Global.designer.cs | 9 +++++++++ Site/App_GlobalResources/Global.resx | 4 ++++ Site/Default.aspx | 20 +++++++++----------- Site/Master-v5.master | 11 ++++++++++- Site/Master-v5.master.cs | 3 +++ Site/Master-v5.master.designer.cs | 3 ++- Site/Scripts/Swarmops-v5.js | 4 ++++ 8 files changed, 42 insertions(+), 13 deletions(-) diff --git a/FrontSocket/FrontendServices.cs b/FrontSocket/FrontendServices.cs index c7d8047a..a79da98a 100644 --- a/FrontSocket/FrontendServices.cs +++ b/FrontSocket/FrontendServices.cs @@ -70,6 +70,7 @@ namespace Swarmops.Frontend.Socket json ["MessageType"] = json["messageType"] = "AnnualProfitLossCents"; json["ProfitLossCents"] = FrontendLoop.GetOrganizationProfitLossCents(this._authority.Organization).ToString(); json["OrganizationId"] = this._authority.Organization.Identity; + json["Instant"] = 1; // instant update, no odometer rolling for init this.Send(json.ToString()); } diff --git a/Site/App_GlobalResources/Global.designer.cs b/Site/App_GlobalResources/Global.designer.cs index 97b424e6..253c4e09 100644 --- a/Site/App_GlobalResources/Global.designer.cs +++ b/Site/App_GlobalResources/Global.designer.cs @@ -537,6 +537,15 @@ namespace Resources { } } + /// + /// Looks up a localized string similar to Annual Profit/Loss To Date ({0}). + /// + internal static string Financial_ProfitToDate { + get { + return ResourceManager.GetString("Financial_ProfitToDate", resourceCulture); + } + } + /// /// Looks up a localized string similar to Receipt Image {0} of {1}. /// diff --git a/Site/App_GlobalResources/Global.resx b/Site/App_GlobalResources/Global.resx index bb7439da..512aa333 100644 --- a/Site/App_GlobalResources/Global.resx +++ b/Site/App_GlobalResources/Global.resx @@ -905,4 +905,8 @@ Type a partial name... + + Annual Profit/Loss To Date ({0}) + {0} is the currency code + \ No newline at end of file diff --git a/Site/Default.aspx b/Site/Default.aspx index 560a7d06..13eb8613 100644 --- a/Site/Default.aspx +++ b/Site/Default.aspx @@ -1,34 +1,32 @@ <%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" Inherits="Swarmops.Frontend.Default" CodeFile="Default.aspx.cs" %> +<%@ Import Namespace="Swarmops.Logic.Support" %> + + <% if (Swarmops.Logic.Support.PilotInstallationIds.IsPilot(PilotInstallationIds.DevelopmentSandbox)) + { %>
-
12342500
Current Participants (Testing new code)
+
12342500
Current Participants
-
125498
Active Participants Last 30 Days (Testing new code)
+
125498
Active Participants Last 30 Days

-
498.001
Current Participants Sollentuna
+
498.001
Current Participants in Your City
- -
-
-
-
0.001
Annual Profit To Date (Testing new code)
-
-
-
+ + <% } %>

diff --git a/Site/Master-v5.master b/Site/Master-v5.master index a0f8ecf8..ce92e809 100644 --- a/Site/Master-v5.master +++ b/Site/Master-v5.master @@ -72,7 +72,8 @@ window.odometerOptions = { auto: false, // Don't automatically initialize everything with class 'odometer' - theme: 'car' // Specify the theme (if you have more than one theme css file on the page) + theme: 'car', // Specify the theme (if you have more than one theme css file on the page) + duration: 1500 // time to update }; $(document).ready(function () { @@ -223,6 +224,14 @@
+
+
+
+
0.001
Profit To Date XYZ
+
+
+
+ <% if (!(this.Page as PageV5Base).IsDashboard) { %>
diff --git a/Site/Master-v5.master.cs b/Site/Master-v5.master.cs index bda4ef25..4a73fb92 100644 --- a/Site/Master-v5.master.cs +++ b/Site/Master-v5.master.cs @@ -259,6 +259,9 @@ namespace Swarmops.Frontend this.MasterLabelBitIdRegisterHeader.Text = Resources.Global.Master_BitIdRegister_Header; + + this.MasterLabelDashboardProfitLoss.Text = String.Format(Resources.Global.Financial_ProfitToDate, + CurrentOrganization.Currency.DisplayCode); } protected string _cacheVersionMark; // this is just a cache buster for style sheets on new versions diff --git a/Site/Master-v5.master.designer.cs b/Site/Master-v5.master.designer.cs index 9a1fba98..cec64c09 100644 --- a/Site/Master-v5.master.designer.cs +++ b/Site/Master-v5.master.designer.cs @@ -596,7 +596,7 @@ namespace Swarmops.Frontend { /// To modify move field declaration from designer file to code-behind file. /// protected global::Swarmops.Frontend.Controls.Base.ModalDialog ModalMasterEnableBitId; - + /// /// MasterLabelBitIdRegisterHeader control. /// @@ -605,5 +605,6 @@ namespace Swarmops.Frontend { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label MasterLabelBitIdRegisterHeader; + protected global::System.Web.UI.WebControls.Label MasterLabelDashboardProfitLoss; } } diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index 5554b552..5ab39b59 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -108,7 +108,11 @@ function _masterInitializeSocket(authenticationTicket) { else if (message.MessageType == "AnnualProfitLossCents") { if (odoProfitLossToDate != undefined) // if there's a P&L odometer on the current page { + if (message.Instant == 1) { + window.odometerOptions.duration = 1; + } odoProfitLossToDate.innerHTML = (message.ProfitLossCents / 100.0) + 0.001; // update it; +0.001 needed for %.2f + window.odometerOptions = 1500; } } else if (message.MessageType == "SandboxUpdate") {