Skip to content

Commit

Permalink
Regression: Fix wrong wizard field name (#10804)
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigok committed May 17, 2018
1 parent 5bfbb98 commit 5f5914e
Showing 1 changed file with 19 additions and 35 deletions.
54 changes: 19 additions & 35 deletions packages/rocketchat-statistics/server/functions/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,30 @@
import _ from 'underscore';
import os from 'os';

const wizardFields = [
'Organization_Type',
'Organization_Name',
'Industry',
'Size',
'Country',
'Website',
'Site_Name',
'Language',
'Server_Type'
];

RocketChat.statistics.get = function _getStatistics() {
const statistics = {};

// Setup Wizard
statistics.wizard = {};
if (RocketChat.models.Settings.findOne('Organization_Type')) {
statistics.wizard.organizationType = RocketChat.models.Settings.findOne('Organization_Type').value;
}

if (RocketChat.models.Settings.findOne('Organization_Name')) {
statistics.wizard.organizationName = RocketChat.models.Settings.findOne('Organization_Name').value;
}

if (RocketChat.models.Settings.findOne('Industry')) {
statistics.wizard.industry = RocketChat.models.Settings.findOne('Industry').value;
}

if (RocketChat.models.Settings.findOne('Size')) {
statistics.wizard.size = RocketChat.models.Settings.findOne('Size').value;
}

if (RocketChat.models.Settings.findOne('Country')) {
statistics.wizard.country = RocketChat.models.Settings.findOne('Country').value;
}

if (RocketChat.models.Settings.findOne('Website')) {
statistics.wizard.website = RocketChat.models.Settings.findOne('Website').value;
}

if (RocketChat.models.Settings.findOne('Site_Name')) {
statistics.wizard.siteName = RocketChat.models.Settings.findOne('Site_Name').value;
}

if (RocketChat.models.Settings.findOne('Language')) {
statistics.wizard.siteName = RocketChat.models.Settings.findOne('Site_Name').value;
}

if (RocketChat.models.Settings.findOne('Server_Type')) {
statistics.wizard.serverType = RocketChat.models.Settings.findOne('Server_Type').value;
}
wizardFields.forEach(field => {
const record = RocketChat.models.Settings.findOne(field);
if (record) {
const wizardField = field.replace(/_/g, '').replace(field[0], field[0].toLowerCase());
statistics.wizard[wizardField] = record.value;
}
});

// Version
statistics.uniqueId = RocketChat.settings.get('uniqueID');
Expand Down

0 comments on commit 5f5914e

Please sign in to comment.