Skip to content

Commit

Permalink
active devices, eslint and code refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukewh committed Dec 20, 2017
1 parent a927fa1 commit 5e10e50
Show file tree
Hide file tree
Showing 14 changed files with 790 additions and 47 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
@@ -0,0 +1,2 @@
static/js/modules
static/js/dist
3 changes: 3 additions & 0 deletions .eslintrc.js
Expand Up @@ -9,6 +9,9 @@ module.exports = {
'extends': [
'eslint:recommended'
],
"parserOptions": {
"sourceType": "module"
},
'rules': {
'indent': [
'error',
Expand Down
56 changes: 56 additions & 0 deletions app.py
Expand Up @@ -472,6 +472,62 @@ def publisher_snap(snap_name):
'name': 'installs',
'values': installs_values
})

version_1_0_values = []
version_1_1_values = []
version_1_2_values = []

for date_index in range(0, metric_period_int):
rand = randint(0, 20)

if len(version_1_0_values) > 0:
version_1_0_value = version_1_0_values[-1] + rand
else:
version_1_0_value = 0

if date_index > 10:
if len(version_1_1_values) > 0:
version_1_1_value = version_1_1_values[-1] + rand
else:
version_1_1_value = 0
version_1_0_value = version_1_0_values[-1] - (rand - 5)
else:
version_1_1_value = 0

if date_index > 20:
if len(version_1_2_values) > 0:
version_1_2_value = version_1_2_values[-1] + rand
else:
version_1_2_value = 0

version_1_1_value = version_1_1_values[-1] - (rand - 5)
else:
version_1_2_value = 0

version_1_0_value = 0 if version_1_0_value < 0 else version_1_0_value
version_1_1_value = 0 if version_1_1_value < 0 else version_1_1_value
version_1_2_value = 0 if version_1_2_value < 0 else version_1_2_value
version_1_0_values.append(version_1_0_value)
version_1_1_values.append(version_1_1_value)
version_1_2_values.append(version_1_2_value)

active_devices['series'] = [
{
'name': '1.0',
'values': version_1_0_values
},
{
'name': '1.1',
'values': version_1_1_values
},
{
'name': '1.2',
'values': version_1_2_values
}
]
active_devices_total = 0
for version in active_devices['series']:
active_devices_total += version['values'][-1]
# end of dummy data

context = {
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"scripts": {
"test": "sass-lint static/**/*.scss --verbose --no-exit",
"test": "sass-lint static/**/*.scss --verbose --no-exit; eslint static/js",
"build": "yarn run build-js && yarn run build-css",
"build-css": "node-sass --include-path node_modules static/sass --output static/css && postcss --use autoprefixer --replace 'static/css/**/*.css' && postcss --use cssnano --dir static/minified 'static/css/**/*.css'",
"build-js": "yarn run copy-3rd-party-js && yarn run build-metrics",
Expand Down

0 comments on commit 5e10e50

Please sign in to comment.