added 260907 version of worker toolkit

This commit is contained in:
2026-09-08 20:30:51 -04:00
parent cbd3f0f8ca
commit 97aca37663
1283 changed files with 142951 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
import Ember from 'ember';
import moment from 'moment';
const {
get,
computed,
Mixin,
setProperties,
inject: {
service,
},
computed: {
alias,
},
} = Ember;
export default Mixin.create({
chartsVisibilityService: service('charts-visibility'),
patternIncludes : alias('chartsVisibilityService.patternIncludes'),
checkins: [],
trackables: [],
isChartEnablerDisabled: computed('patternIncludes.length', function() {
return get(this, 'patternIncludes.length') === 0;
}),
setChartsData() {
const tags = this.store.peekAll('tag').toArray();
const foods = this.store.peekAll('food').toArray();
const checkins = this.peekSortedCheckins();
const symptoms = this.store.peekAll('symptom').toArray();
const conditions = this.store.peekAll('condition').toArray();
const treatments = this.store.peekAll('treatment').toArray();
const harveyBradshawIndices = this.store.peekAll('harveyBradshawIndex').toArray();
const trackables = [...conditions, ...symptoms, ...treatments, ...tags, ...foods, ...harveyBradshawIndices];
return this.isDestroyed || setProperties(this, {checkins, trackables});
},
peekSortedCheckins() {
return this
.store
.peekAll('checkin')
.toArray()
.sort(
(a, b) => moment(get(a, 'date')).diff(get(b, 'date'), 'days')
);
},
});

View File

@@ -0,0 +1,43 @@
import Ember from 'ember';
import moment from 'moment';
const {
get,
computed,
Mixin,
} = Ember;
export default Mixin.create({
startAt: computed('daysRadius', 'centeredDate', function() {
const daysRadius = get(this, 'daysRadius');
const centeredDate = get(this, 'centeredDate');
if (centeredDate) {
return moment(centeredDate).subtract(daysRadius, 'days');
} else {
return moment().subtract(daysRadius * 2, 'days');
}
}),
endAt: computed('daysRadius', 'centeredDate', function() {
const centeredDate = get(this, 'centeredDate');
if (centeredDate) {
return moment(centeredDate).add(get(this, 'daysRadius'), 'days');
} else {
return moment();
}
}),
daysRadius: computed('SVGWidth', function() {
return Math.ceil(get(this, 'SVGWidth') / (get(this, 'pixelsPerDate') * 2));
}),
startAtWithCache: computed('startAt', function() {
return moment(get(this, 'startAt')).subtract(get(this, 'daysRadius'), 'days');
}),
endAtWithCache: computed('endAt', function() {
return moment(get(this, 'endAt')).add(get(this, 'daysRadius'), 'days');
})
})