More code for live profit

This commit is contained in:
Falkvinge
2017-05-09 22:18:10 +02:00
parent fb005ce472
commit bf954cf3b0
3 changed files with 12 additions and 6 deletions
+3 -3
View File
@@ -308,9 +308,9 @@ namespace Swarmops.Frontend.Socket
Int64 annualProfitLossCents = GetOrganizationProfitLossCents(organization);
JObject json = new JObject();
json["messageType"] = "AnnualProfitLossCents";
json["profitLossCents"] = annualProfitLossCents.ToString();
json["organizationId"] = organization.Identity;
json["MessageType"] = "AnnualProfitLossCents";
json["ProfitLossCents"] = annualProfitLossCents.ToString();
json["OrganizationId"] = organization.Identity;
BroadcastToOrganization(organization, json);
}
+3 -3
View File
@@ -67,9 +67,9 @@ namespace Swarmops.Frontend.Socket
base.OnOpen();
JObject json = new JObject();
json ["messageType"] = json["messageType"] = "AnnualProfitLossCents";
json["profitLossCents"] = FrontendLoop.GetOrganizationProfitLossCents(this._authority.Organization).ToString();
json["organizationId"] = this._authority.Organization.Identity;
json ["MessageType"] = json["messageType"] = "AnnualProfitLossCents";
json["ProfitLossCents"] = FrontendLoop.GetOrganizationProfitLossCents(this._authority.Organization).ToString();
json["OrganizationId"] = this._authority.Organization.Identity;
this.Send(json.ToString());
}
+6
View File
@@ -105,6 +105,12 @@ function _masterInitializeSocket(authenticationTicket) {
else if (message.MessageType == "Malfunctions") {
_master_updateMalfunctions (message.MalfunctionsList);
}
else if (message.MessageType == "AnnualProfitLossCents") {
if (odoProfitLossToDate != undefined) // if there's a P&L odometer on the current page
{
odoProfitLossToDate.innerHTML = (message.ProfitLossCents / 100.0) + 0.001; // update it; +0.001 needed for %.2f
}
}
else if (message.MessageType == "SandboxUpdate") {
if (odoLocalParticipation != undefined) { // Real ugly accessing specific page elements here, but it's temporary
odoLocalParticipation.innerHTML = message.Local;