Skip to content

Commit

Permalink
Remove unnecessary check of docs count
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsarm committed May 18, 2021
1 parent c6ad957 commit 49c54d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
15 changes: 3 additions & 12 deletions webapp/src/ts/services/telemetry.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export class TelemetryService {
// moment when the aggregation starts (the beginning of the current day)
private aggregateStartsAt() {
return moment().startOf('day');
//return moment().startOf('minute');
}

// if there is telemetry data from previous days, aggregation is performed and the data destroyed
Expand All @@ -90,13 +89,9 @@ export class TelemetryService {
const dbDate = moment(this.getFirstAggregatedDate());

if (dbDate.isBefore(startOf)) {
return db.info()
.then(info => {
if (info.doc_count > 0) {
return this.aggregate(db)
.then(() => this.reset(db));
}
});
return this
.aggregate(db)
.then(() => this.reset(db));
}
}

Expand All @@ -114,8 +109,6 @@ export class TelemetryService {
metadata.year,
metadata.month,
metadata.day,
//metadata.hour,
//metadata.minute,
metadata.user,
metadata.deviceId,
].join('-');
Expand All @@ -140,8 +133,6 @@ export class TelemetryService {
year: date.year(),
month: date.month() + 1,
day: date.date(),
//hour: date.hour(),
//minute: date.minute(),
user: this.sessionService.userCtx().name,
deviceId: this.getUniqueDeviceId(),
versions: {
Expand Down
1 change: 0 additions & 1 deletion webapp/tests/karma/ts/services/telemetry.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ describe('TelemetryService', () => {
dbService = { get: () => dbInstance };
consoleErrorSpy = sinon.spy(console, 'error');
pouchDb = {
info: sinon.stub().resolves({doc_count: 10}),
post: sinon.stub().resolves(),
close: sinon.stub(),
destroy: sinon.stub().callsFake(() => {
Expand Down

0 comments on commit 49c54d5

Please sign in to comment.