diff --git a/docs/plugins/alexa-templates/en-us.json b/docs/plugins/alexa-templates/en-us.json index 79cc1baa977d..e890172dcbab 100644 --- a/docs/plugins/alexa-templates/en-us.json +++ b/docs/plugins/alexa-templates/en-us.json @@ -233,6 +233,16 @@ "name": { "value": "cgm mode" } + }, + { + "name": { + "value": "db size", + "synonyms": [ + "database size", + "data size", + "file size" + ] + } } ] } diff --git a/docs/plugins/google-home-templates/en-us.zip b/docs/plugins/google-home-templates/en-us.zip index d8ada2a834a2..551e51307f05 100644 Binary files a/docs/plugins/google-home-templates/en-us.zip and b/docs/plugins/google-home-templates/en-us.zip differ diff --git a/lib/language.js b/lib/language.js index ac9b0a022184..64098826fdea 100644 --- a/lib/language.js +++ b/lib/language.js @@ -15133,7 +15133,7 @@ function init() { ,nl: 'Datagrootte' }, 'virtAsstDatabaseSize': { - en: '%1 MiB that is %2% of available database space' + en: '%1 MiB. That is %2% of available database space.' ,pl: '%1 MiB co stanowi %2% przestrzeni dostępnej dla bazy danych' ,nl: '%1 MiB dat is %2% van de beschikbaare database ruimte' }, diff --git a/lib/plugins/dbsize.js b/lib/plugins/dbsize.js index c76e36cb9e85..1b6b43da8eda 100644 --- a/lib/plugins/dbsize.js +++ b/lib/plugins/dbsize.js @@ -119,9 +119,9 @@ function init (ctx) { function virtAsstDatabaseSizeHandler (next, slots, sbx) { var display = _.get(sbx, 'properties.dbsize.display'); - var dataSize = _.get(sbx, 'properties.dbsize.details.dataSize'); - var dataPercentage = _.get(sbx, 'properties.dbsize.dataPercentage'); if (display) { + var dataSize = _.get(sbx, 'properties.dbsize.details.dataSize'); + var dataPercentage = _.get(sbx, 'properties.dbsize.dataPercentage'); var response = translate('virtAsstDatabaseSize', { params: [ dataSize @@ -137,13 +137,8 @@ function init (ctx) { dbsize.virtAsst = { intentHandlers: [ { - // for backwards compatibility - intent: 'DatabaseSize' - , intentHandler: virtAsstDatabaseSizeHandler - } - , { intent: 'MetricNow' - , metrics: ['database size', 'file size', 'db size', 'data size'] + , metrics: ['db size'] , intentHandler: virtAsstDatabaseSizeHandler } ] diff --git a/lib/plugins/index.js b/lib/plugins/index.js index 5a6cb2822da3..77a87bcd94db 100644 --- a/lib/plugins/index.js +++ b/lib/plugins/index.js @@ -74,6 +74,7 @@ function init (ctx) { , require('./treatmentnotify')(ctx) , require('./timeago')(ctx) , require('./basalprofile')(ctx) + , require('./dbsize')(ctx) ]; plugins.registerServerDefaults = function registerServerDefaults () { diff --git a/lib/plugins/virtAsstBase.js b/lib/plugins/virtAsstBase.js index e0d103672a2e..781f56969cf1 100644 --- a/lib/plugins/virtAsstBase.js +++ b/lib/plugins/virtAsstBase.js @@ -81,7 +81,7 @@ function init(env, ctx) { }; virtAsstBase.setupVirtAsstHandlers = function (configuredPlugin) { - ctx.plugins.eachEnabledPlugin(function (plugin){ + ctx.plugins.eachEnabledPlugin(function (plugin) { if (plugin.virtAsst) { if (plugin.virtAsst.intentHandlers) { console.log('Plugin "' + plugin.name + '" supports Virtual Assistants'); diff --git a/tests/dbsize.test.js b/tests/dbsize.test.js index 0a66bb3ad6d7..ce95f8652c05 100644 --- a/tests/dbsize.test.js +++ b/tests/dbsize.test.js @@ -300,18 +300,13 @@ describe('Database Size', function() { var dbsize = require('../lib/plugins/dbsize')(ctx); dbsize.setProperties(sbx); - dbsize.virtAsst.intentHandlers.length.should.equal(2); + dbsize.virtAsst.intentHandlers.length.should.equal(1); dbsize.virtAsst.intentHandlers[0].intentHandler(function next (title, response) { title.should.equal('Database file size'); - response.should.equal('450 MiB that is 90% of available database space'); + response.should.equal('450 MiB. That is 90% of available database space.'); - dbsize.virtAsst.intentHandlers[1].intentHandler(function next (title, response) { - title.should.equal('Database file size'); - response.should.equal('450 MiB that is 90% of available database space'); - - done(); - }, [], sbx); + done(); }, [], sbx);