Skip to content

Commit

Permalink
### 1.0.0 (2016-05-20)
Browse files Browse the repository at this point in the history
* (bluefox) change default aggregation name
  • Loading branch information
GermanBluefox committed May 20, 2016
1 parent c621a56 commit 2d86ac4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,17 @@ Possible options:
- **limit** - do not return more entries than limit
- **ignoreNull** - if null values should be include (false), replaced by last not null value (true) or replaced with 0 (0)
- **aggregate** - aggregate method:
- *m4* - used M4 algorithm. Splice the whole time range in small intervals and find for every interval max, min, start and end values.
- *minmax* - used special algorithm. Splice the whole time range in small intervals and find for every interval max, min, start and end values.
- *max* - Splice the whole time range in small intervals and find for every interval max value and use it for this interval (nulls will be ignored).
- *min* - Same as max, but take minimal value.
- *average* - Same as max, but take average value.
- *total* - Same as max, but calculate total value.
- *count* - Same as max, but calculate number of values (nulls will be calculated).

## Changelog
### 1.0.0 (2016-05-20)
* (bluefox) change default aggregation name

### 0.4.1 (2016-05-14)
* (bluefox) support sessionId

Expand Down
7 changes: 6 additions & 1 deletion io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
"de": "Loggt die Historie von einzelnen Zuständen",
"ru": "Сохранять историю событий для отдельных состояний"
},
"version": "0.4.1",
"news": {
"en": "(bluefox) change default aggregation name",
"de": "(bluefox) change default aggregation name",
"ru": "(bluefox) change default aggregation name"
},
"version": "1.0.0",
"mode": "daemon",
"platform": "Javascript/Node.js",
"loglevel": "info",
Expand Down
6 changes: 3 additions & 3 deletions lib/aggregate.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function initAggregate(options) {
options.maxIndex = Math.ceil(((options.end - options.start) / options.step) - 1);
options.result = [];
options.averageCount = [];
options.aggregate = options.aggregate || 'm4';
options.aggregate = options.aggregate || 'minmax';
options.overallLength = 0;

// pre-fill the result with timestamps (add one before start and one after end)
Expand Down Expand Up @@ -69,7 +69,7 @@ function aggregation(options, data) {
} else if (options.aggregate === 'total') {
if (!options.result[index].val.ts) options.result[index].val.ts = Math.round(options.start + ((index + 0.5) * options.step));
options.result[index].val.val += parseFloat(data[i].val);
} else if (options.aggregate === 'm4') {
} else if (options.aggregate === 'minmax') {
if (options.result[index].min.ts === null) {
options.result[index].min.ts = data[i].ts;
options.result[index].min.val = data[i].val;
Expand Down Expand Up @@ -109,7 +109,7 @@ function aggregation(options, data) {
}

function finishAggregation(options) {
if (options.aggregate === 'm4') {
if (options.aggregate === 'minmax') {
for (var ii = options.result.length - 1; ii >= 0; ii--) {
// no one value in this period
if (options.result[ii].start.ts === null) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "iobroker.history",
"description": "Log state history in a two-stages process (first to Redis, then to CouchDB)",
"version": "0.4.1",
"description": "Log state history in a two-stages process (first to RAM, then to disk)",
"version": "1.0.0",
"author": "hobbyquaker <[email protected]>",
"contributors": [
"bluefox <[email protected]>",
Expand Down

0 comments on commit 2d86ac4

Please sign in to comment.