Skip to content

Commit 8b95170

Browse files
committed
Fixed audioReady timer.
1 parent 54ab3f6 commit 8b95170

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

src/admin/trades.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ var TradesListController = ($scope : TradesScope, $log : ng.ILogService, subscri
119119
if ($scope.trade_statuses[i].alloc >= $scope.trade_statuses[i].quantity)
120120
$scope.trade_statuses[i].side = 'K';
121121
$scope.gridApi.grid.notifyDataChange(uiGridConstants.dataChange.ALL);
122-
if (!t.loadedFromBD && $scope.audio) {
122+
if (t.loadedFromDB === false && $scope.audio) {
123123
var audio = new Audio('/audio/'+(merged?'boom':'erang')+'.mp3');
124124
audio.volume = 0.5;
125125
audio.play();
@@ -129,7 +129,7 @@ var TradesListController = ($scope : TradesScope, $log : ng.ILogService, subscri
129129
}
130130
if (!exists) {
131131
$scope.trade_statuses.push(new DisplayTrade($scope, t));
132-
if (!t.loadedFromBD && $scope.audio) {
132+
if (t.loadedFromDB === false && $scope.audio) {
133133
var audio = new Audio('/audio/boom.mp3');
134134
audio.volume = 0.5;
135135
audio.play();

src/common/models.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ export class Trade implements ITimestamped {
253253
public alloc: number,
254254
public allocprice: number,
255255
public feeCharged: number,
256-
public loadedFromBD: boolean) {}
256+
public loadedFromDB: boolean) {}
257257
}
258258

259259
export class CurrencyPosition {

src/service/broker.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ export class OrderBroker implements Interfaces.IOrderBroker {
249249
trade.value = Math.abs(trade.price*trade.quantity);
250250
if (this._trades[i].quantity<=this._trades[i].alloc)
251251
this._trades[i].value = Math.abs((this._trades[i].quantity*this._trades[i].price)-(this._trades[i].alloc*this._trades[i].allocprice));
252+
this._trades[i].loadedFromDB = false;
252253
this._tradePublisher.publish(this._trades[i]);
253254
this._tradePersister.repersist(this._trades[i], this._trades[i]);
254255
break;
@@ -263,6 +264,7 @@ export class OrderBroker implements Interfaces.IOrderBroker {
263264
this._trades[i].time = trade.time;
264265
this._trades[i].quantity += trade.quantity;
265266
this._trades[i].value += trade.value;
267+
this._trades[i].loadedFromDB = false;
266268
this._tradePublisher.publish(this._trades[i]);
267269
this._tradePersister.repersist(this._trades[i], this._trades[i]);
268270
break;

src/service/persister.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface Persistable {
2727
time?: moment.Moment|Date;
2828
pair?: Models.CurrencyPair;
2929
exchange?: Models.Exchange;
30-
loadedFromBD?: boolean;
30+
loadedFromDB?: boolean;
3131
}
3232

3333
export class LoaderSaver {
@@ -39,7 +39,7 @@ export class LoaderSaver {
3939
if (typeof x.pair === "undefined")
4040
x.pair = this._pair;
4141
if (setDBFlag === true)
42-
x.loadedFromBD = true;
42+
x.loadedFromDB = true;
4343
};
4444

4545
public saver = (x: Persistable) => {
@@ -49,6 +49,8 @@ export class LoaderSaver {
4949
x.exchange = this._exchange;
5050
if (typeof x.pair === "undefined")
5151
x.pair = this._pair;
52+
if (typeof x.loadedFromDB !== "undefined")
53+
delete x.loadedFromDB;
5254
};
5355

5456
constructor(private _exchange: Models.Exchange, private _pair: Models.CurrencyPair) { }

0 commit comments

Comments
 (0)