-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from open-nomie/develop
4.0.84 Merge
- Loading branch information
Showing
72 changed files
with
3,761 additions
and
1,170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
node_modules | ||
public/bundle.* | ||
package-lock.json | ||
plugins/*/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,18 +54,20 @@ npm run dev | |
|
||
## Data Storage | ||
|
||
Blockstack.org is a "Decentralized computing network and app ecosystem" - basically, it offers a means to auth a user, and get/put files that are encrypted. This means Nomie works with flat files that require a network lookup. I've decided to create a "log book" for each month. Even heavy users will have a monthly book less than 100k, so that seemed reasonable. Plus doing it every day would require way too many network lookups when generating stats, and each year would be too big for and risky. | ||
Open Nomie as of Jul 27, will support either local (with localforage) or cloud (with blockstack) | ||
|
||
/v01/data/books/2019-01 | ||
All storage is done based a key, value - so adding additional storage options in the future should be pretty easy. | ||
|
||
- v01 - a way to make upgrading easier without affecting users existing data stores | ||
- data - generic | ||
- books - holder of books | ||
- 2019-01 - json array of logs | ||
Blockstack.org is a "Decentralized computing network and app ecosystem" - basically, it offers a means to auth a user, and get/put files that are encrypted. This means Nomie works with flat files that require a network lookup. I've decided to create a "log book" for each month. Even heavy users will have a monthly book less than 100k, so that seemed reasonable. Plus doing it every day would require way too many network lookups when generating stats, and each year would be too big for and risky. | ||
|
||
/v01/data/books/2019-01 - array of logs | ||
/v01/data/trackers.json - trackers | ||
/v01/data/boards.json - users board configuration | ||
|
||
## Component / Container Issues | ||
|
||
I don't like having a bunch of floating variables around, so like Vue, and Svete 2 - I tend to group data and methods together. But I flipped about half way through calling it data, to then calling it state. I'm not sure which will stick. | ||
|
||
# Current Tracker Types | ||
|
||
**tick** Single Tap | ||
|
@@ -92,6 +94,10 @@ Tap to start, tap to stop. The timer is great for tracking durations. | |
- **Keep cleaning, organizing and testing** - this project didn't start very clean, or ready for unit testing, this should be an on going objective. | ||
- **Use what's there** - Twitter bootstrap ([and all it's classes](https://getbootstrap.com/)) are available, reuse what already exists before writing new - especially css. | ||
|
||
## Trademark License | ||
|
||
Nomie and the Blue Elephant are registered Trademarks of Happy Data, LLC. Indianapolis, IN. For a commercial use of the brand or logomark please contact [email protected] | ||
|
||
## MIT License | ||
|
||
Copyright 2019 Happy Data, LLC <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,46 @@ | ||
# TODO | ||
|
||
Generated Sun Jul 21 2019 9:12 pm | ||
Generated Sun Jul 28 2019 12:00 pm | ||
|
||
- **src/store/user.js** | ||
- TODO: Look at push notifications in the browser | ||
- TODO: Add 10 minute interval to check for day change - if change, fire a new user.ready | ||
- **src/store/ledger.js** | ||
- TODO: this doesn't seem to be trigger a change in History.svetle | ||
- TODO: Make this use listBooks() array to only look for books that exist | ||
- **src/store/boards.js** | ||
- TODO: figure out why duplicates happen on board saving | ||
- TODO: tried to make this a spread - but I keep breaking it. | ||
- **src/scss/main.scss** | ||
- TODO: Look at making prefers-color-scheme work properly - when enabled, only buttons change | ||
- **src/routes/stats.svelte** | ||
- TODO: Needs to be refactored and cleaned up | ||
- **src/routes/settings.svelte** | ||
- TODO: figure out how to handle a cancel in the interact prompt | ||
- **src/routes/history.svelte** | ||
- TODO: Have it react when the ledger change, not a hard refresh | ||
- TODO: refactor so it's clean and using the proper amount of Store vs local | ||
- TODO: Look at making this refresh without doing the loading, it's pushing the page to the top and it's annoying | ||
- TODO: This is really sloppy - clean it up. | ||
- TODO: Search Day Header isn't working reliably... Pulling it for now. | ||
- **src/routes/board-editor.svelte** | ||
- TODO: Make sorting work | ||
- TODO: Fix Sorting on MObile --> | ||
- **src/modules/stats/stats.js** | ||
- TODO: Implement IgnoreZeros | ||
- **src/containers/tracker/input/keypad.svelte** | ||
- and one for the pin-lock container - TODO: merge these some day | ||
- **src/containers/map/map.svelte** | ||
- TODO: Look at making this curved dotted lines - and not just straight ones | ||
- **src/containers/importer/importer.svelte** | ||
- Modal will be hidden in settings TODO: make this not hacky --> | ||
- **src/containers/board/tracker-button.svelte** | ||
- TODO: Move this to components/tracker-button | ||
- **src/containers/board/board.svelte** | ||
- TODO: fix user store to be a correct store | ||
- TODO: Look at why this is needed... slop! | ||
- TODO: Finish this starter pack add trackers, make them installable. --> | ||
- **src/components/capture-log.svelte** | ||
- TODO: Add a media/photo type of thing that can be added to a log.. | ||
- TODO: Mobile is getting GMT Time, desktop is not | ||
- await LedgerStore.saveLog($ActiveLogStore); TODO: Make ledger task instead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "[email protected]", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/// <reference types="Cypress" /> | ||
|
||
context('App', () => { | ||
beforeEach(() => { | ||
cy.visit('http://localhost:5000'); | ||
}); | ||
|
||
it('cy.hash() - get the current URL hash', () => { | ||
// https://on.cypress.io/hash | ||
cy.hash().should('be.empty'); | ||
}); | ||
it('next button', () => { | ||
cy.wait(200); | ||
|
||
cy.get('.footer-buttons > .btn') | ||
.contains('Next') | ||
.click(); | ||
|
||
cy.wait(200); | ||
|
||
cy.get('.footer-buttons > .btn') | ||
.contains('Next') | ||
.click(); | ||
|
||
cy.wait(200); | ||
|
||
cy.get('.footer-buttons > .btn') | ||
.contains('Next') | ||
.click(); | ||
|
||
cy.wait(200); | ||
|
||
cy.get('.footer-buttons > .btn') | ||
.contains('Next') | ||
.click(); | ||
|
||
cy.wait(200); | ||
|
||
// select local storage | ||
cy.get('.content > :nth-child(2)').click(); | ||
|
||
cy.wait(200); | ||
|
||
cy.get('.footer-buttons > .btn') | ||
.contains('Next') | ||
.click(); | ||
|
||
// cy.get('.footer-buttons > .btn') | ||
// .contains('Login/Register') | ||
// .click(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import Log from '../../../src/modules/nomie-log/nomie-log'; | ||
|
||
describe('modules/nomie-log', function() { | ||
let log; | ||
let stub = { | ||
note: `I'm a note for #testing and I'm #good(344) and #good and kinda #bad sometimes #bad`, | ||
}; | ||
|
||
it('log initializes', () => { | ||
log = new Log(stub); | ||
expect(log).to.be.instanceOf(Log); | ||
expect(log.note).to.equal(stub.note); | ||
}); | ||
|
||
it('log.toObject', () => { | ||
log = new Log(stub); | ||
expect(log.toObject()._id).to.be.a('string'); | ||
}); | ||
it('log.expanded', () => { | ||
log = new Log(stub); | ||
log.expanded(); | ||
expect(log.trackers.testing.value).to.equal(1); | ||
}); | ||
it('log.hasTracker', () => { | ||
log = new Log(stub); | ||
log.expanded(); | ||
expect(log.hasTracker('testing')).to.equal(true); | ||
expect(log.hasTracker('nothing')).to.equal(false); | ||
}); | ||
it('log.trackersArray', () => { | ||
log = new Log(stub); | ||
log.expand(); | ||
let trackers = log.trackersArray(); | ||
expect(trackers.length).to.equal(3); | ||
}); | ||
it('log.addTag', () => { | ||
log = new Log(stub); | ||
log.expanded(); | ||
log.addTag('cheese', 44); | ||
expect(log.hasTracker('cheese')).to.equal(true); | ||
expect(log.trackers.cheese.value).to.equal(44); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import Stats from '../../../src/modules/stats/stats'; | ||
import NomieLog from '../../../src/modules/nomie-log/nomie-log'; | ||
import Tracker from '../../../src/modules/tracker/tracker'; | ||
import dayjs from 'dayjs'; | ||
|
||
// TODO: write tests for mean math trackers | ||
|
||
describe('modules/nomie-log', function() { | ||
let rows = [ | ||
new NomieLog({ | ||
note: `I'm the #first #note and I'm #good(10)`, | ||
}), | ||
new NomieLog({ | ||
note: `I'm the #middle #note and I'm #good(104) too`, | ||
end: dayjs() | ||
.subtract(1, 'day') | ||
.toDate() | ||
.getTime(), | ||
}), | ||
new NomieLog({ | ||
note: `I'm the #last #note and I'm #bad and #good(1)`, | ||
}), | ||
new NomieLog({ | ||
note: `I'm a thing`, | ||
}), | ||
]; | ||
|
||
let stats = new Stats(rows, new Tracker({ tag: 'good' })); | ||
|
||
it('stats initializes', () => { | ||
expect(stats).to.be.instanceOf(Stats); | ||
}); | ||
it('stats rows should expand', () => { | ||
expect(stats.rows[0].trackers.first.value).to.equal(1); | ||
}); | ||
it('results.year.count', () => { | ||
expect(stats.results.year.count).to.equal(3); | ||
}); | ||
it('results.month.count', () => { | ||
expect(stats.results.month.count).to.equal(3); | ||
}); | ||
it('results.day.count', () => { | ||
expect(stats.results.day.count).to.equal(2); | ||
}); | ||
it('getValueMap', () => { | ||
let todayKey = dayjs().format('YYYY-MM-DD'); | ||
let yesterdayKey = dayjs() | ||
.subtract(1, 'day') | ||
.format('YYYY-MM-DD'); | ||
let valueMap = stats.getValueMap(rows); | ||
expect(valueMap[todayKey]).to.be.instanceOf(Array); | ||
expect(valueMap[todayKey]).to.include.members([10, 1]); | ||
expect(valueMap[yesterdayKey]).to.include.members([104]); | ||
}); | ||
|
||
it('getMinMaxFromValueMap()', () => { | ||
let valueMap = stats.getValueMap(rows); | ||
expect(stats.getMinMaxFromValueMap(valueMap).min.value).to.equal(11); | ||
expect(stats.getMinMaxFromValueMap(valueMap).max.value).to.equal(104); | ||
}); | ||
|
||
it('getRows - day', () => { | ||
// number of days the tag shows up in the day | ||
expect(stats.getRows('day').length).to.equal(2); | ||
}); | ||
|
||
it('getRows - month', () => { | ||
// number of days the tag shows up in the month | ||
expect(stats.getRows('month').length).to.equal(3); | ||
}); | ||
|
||
it('getChartData - month', () => { | ||
// number of days the tag shows up in the month | ||
expect(stats.toChartData('month').labels[0]).to.equal('01'); | ||
// Check today's value | ||
expect(stats.toChartData('month').points[new Date().getDate() - 1].y).to.equal(11); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import Tracker from '../../../src/modules/tracker/tracker'; | ||
|
||
describe('modules/tracker', function() { | ||
let tracker; | ||
let stub = { | ||
tag: 'taggy_tag', | ||
label: 'Tester', | ||
uom: 'mile', | ||
emoji: '🥪', | ||
type: 'value', | ||
color: '#555555', | ||
default: 10, | ||
math: 'mean', | ||
}; | ||
|
||
it('tracker initializes', () => { | ||
tracker = new Tracker(stub); | ||
expect(tracker).to.be.instanceOf(Tracker); | ||
expect(tracker.label).to.equal(stub.label); | ||
expect(tracker.tag).to.equal(stub.tag); | ||
expect(tracker.emoji).to.equal(stub.emoji); | ||
expect(tracker.type).to.equal(stub.type); | ||
expect(tracker.default).to.equal(stub.default); | ||
expect(tracker.color).to.equal(stub.color); | ||
expect(tracker.uom).to.equal(stub.uom); | ||
expect(tracker.math).oneOf(['sum', 'mean']); | ||
// expect(math.sum([1, 2])).to.equal(3); | ||
}); | ||
it('tracker.displayValue', () => { | ||
tracker = new Tracker(stub); | ||
expect(tracker.displayValue(100)).to.equal('100mi'); | ||
// expect(math.sum([1, 2])).to.equal(3); | ||
}); | ||
it('tracker.displayTag', () => { | ||
tracker = new Tracker(stub); | ||
expect(tracker.displayTag()).to.equal('Taggy Tag'); | ||
// expect(math.sum([1, 2])).to.equal(3); | ||
}); | ||
it('tracker.toTag', () => { | ||
tracker = new Tracker(stub); | ||
expect(tracker.toTag('Brandon Is Good !!!')).to.equal('brandon_is_good'); | ||
// expect(math.sum([1, 2])).to.equal(3); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { BoardStore } from '../../../src/store/boards'; | ||
|
||
// TODO: Make more complete | ||
describe('store/board', function() { | ||
it('base data', () => { | ||
expect(BoardStore.data().active).to.equal('all'); | ||
expect(BoardStore.data().boards).to.be.instanceOf(Array); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import extractor from '../../../src/utils/extract-trackers/extract-trackers'; | ||
|
||
describe('utils/extract-trackers', function() { | ||
it('extract-tracker', () => { | ||
let note = 'This is a #test of Nomies #extractor(4) and #cheese #cheese #cheese'; | ||
let results = extractor(note); | ||
|
||
expect(results.test.tracker).to.equal('test'); | ||
expect(results.test.value).to.equal(1); | ||
expect(results.extractor.value).to.equal(4); | ||
expect(results.cheese.value).to.equal(3); | ||
|
||
// expect(math.sum([1, 2])).to.equal(3); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import math from '../../../src/utils/math/math'; | ||
|
||
describe('utils/math', function() { | ||
it('math.sum', () => { | ||
expect(math.sum([1, 2])).to.equal(3); | ||
}); | ||
it('math.average', () => { | ||
expect(math.average([30, 344, 21, 23])).to.equal(104.5); | ||
}); | ||
it('math.round - default', () => { | ||
expect(math.round(10.12345)).to.equal(10.12); | ||
}); | ||
it('math.round - 1000', () => { | ||
expect(math.round(10.12345, 1000)).to.equal(10.123); | ||
}); | ||
it('math.round - 10', () => { | ||
expect(math.round(10.12345, 10)).to.equal(10.1); | ||
}); | ||
it('math.max', () => { | ||
expect(math.max([0, 12, 223, 332, 12, 345, 32.32, -324])).to.equal(345); | ||
}); | ||
it('math.min - negative', () => { | ||
expect(math.min([0, 12, 223, 332, 12, 345, 32.32, -324, 443])).to.equal(-324); | ||
}); | ||
it('math.min - no negative', () => { | ||
expect(math.min([1, 12, 223, 332, 12, 345, 32.32, 443])).to.equal(1); | ||
}); | ||
it('math.percentage', () => { | ||
expect(math.percentage(100, 50)).to.equal(50); | ||
}); | ||
it('math.random', () => { | ||
expect(math.random([10, 20, 30])).to.be.oneOf([10, 20, 30]); | ||
}); | ||
it('math.random_range', () => { | ||
expect(math.random_range(0, 100)).to.be.within(0, 100); | ||
}); | ||
it('math.percentile', () => { | ||
expect(math.percentile([0, 50, 100])).to.include.members([0, 50, 100]); | ||
}); | ||
it('math.trustfulNumber', () => { | ||
expect(math.trustfulNumber(32 + 'abc', 0)).to.equal(0); | ||
}); | ||
}); |
Oops, something went wrong.