Skip to content

Commit

Permalink
Merge pull request #229 from GeriLife/develop
Browse files Browse the repository at this point in the history
0.11 release
  • Loading branch information
brylie authored Jan 7, 2018
2 parents cf5dffb + f03339c commit bf80fa8
Show file tree
Hide file tree
Showing 287 changed files with 2,327 additions and 457 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
.meteor/meteorite
server/smtp.js
node_modules
.idea
*.pyc
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Template.homeActivityCountsByActivityType.onCreated(function () {

// Call method to fetch data, assigning it to reactive variable
Meteor.call('getHomeActivityTypeCountsLast30days', homeId, function (error, chartData) {
console.log('chartData', chartData);
// update chart data reactive variable
templateInstance.chartData.set(chartData);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Template.homeActivityCountsByFacilitatorRole.onCreated(function () {

// Call method to fetch data, assigning it to reactive variable
Meteor.call('getHomeActivitiesFacilitatorRolesCountsLast30days', homeId, function (error, chartData) {
console.log('chartData', chartData);
// update chart data reactive variable
templateInstance.chartData.set(chartData);
});
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Template.homeResidentActivitySumsByType.created = function () {
instance.homeResidentsActivitySumsByType = new ReactiveVar();

// Get home resident activity sums from server method
Meteor.call('getHomeResidentsActivitySumsByType', instance.homeId, function (error, activitySums) {
Meteor.call('getHomeResidentsActivitySumsByTypeLast30Days', instance.homeId, function (error, activitySums) {
//Set the home resident activity sums variable with the returned activity sums
instance.homeResidentsActivitySumsByType.set(activitySums);
});
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h1 class="page-header">
{{/ if }}
</h1>
<div class="row">
<div class="col-xs-12 col-md-6">
<div class="col-xs-12 col-lg-6">
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-header">
Expand All @@ -23,7 +23,7 @@ <h2 class="panel-header">
</div>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="col-xs-12 col-lg-6">
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-header">
Expand Down Expand Up @@ -72,7 +72,7 @@ <h2 class="panel-header">
<!-- Activity counts by activity type -->
{{> homeActivityCountsByActivityType homeId=home._id }}
</div>

<div class="col-md-6">
<!-- Activity counts by facilitator role -->
{{> homeActivityCountsByFacilitatorRole homeId=home._id }}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template name="homeResidentActiveOnDate">
{{# if residentActiveOnDate }}
<i class="fa fa-check" aria-hidden="true"></i>
{{/ if }}
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Template.homeResidentActiveOnDate.onCreated(function () {
const templateInstance = this;

// Get resident ID and date from template data context
const residentId = this.data.resident._id;
const date = this.data.day;

// Create ISO date string (YYYY-mm-dd) from date
const isoYMD = moment(date).format('YYYY-mm-dd');

// Create string to request activity count for resident ID and current date (YMD)
const countName = `residentId-${ residentId }-activityCountOn-${ isoYMD }`;

// Subscribe to resident activity count for current date
templateInstance.subscribe('residentActivityCountOnDate', residentId, date);

// Create reactive variable to hold resident activity count
templateInstance.residentActivityCountOnDate = new ReactiveVar();

templateInstance.autorun(function () {
// Get count of activities for resident ID and current date (see above)
const activityCount = Counts.get(countName);

// Set activity count to template reactive variable
templateInstance.residentActivityCountOnDate.set(activityCount);
})
});

Template.homeResidentActiveOnDate.helpers({
residentActiveOnDate () {
// Get reference to template instance
const templateInstance = Template.instance();

// Residents are inactive by default, until there is a known activity count
let residentActiveOnDate = false;

// Get activity count, from reactive variable
const activityCount = templateInstance.residentActivityCountOnDate.get();

// If resident has activity count, they are considered active on date
if (activityCount > 0) {
residentActiveOnDate = true;
}

return residentActiveOnDate;
}
})
18 changes: 18 additions & 0 deletions app/client/views/home/residents/resident/resident.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template name="homeResident">
<tr id="resident-{{ _id }}" class="resident">
<td>{{ resident.firstName }} {{ resident.lastInitial }}</td>
<td class="activity-count">
{{ recentActiveDaysCount }}
</td>
<td class="{{ activityLabelClass }}">
{{#if activityLabelText }}
{{ activityLabelText }}
{{/ if }}
</td>
{{# each day in pastSevenDays }}
<td>
{{> homeResidentActiveOnDate resident=resident day=day }}
</td>
{{/ each }}
</tr>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ Template.homeResident.onCreated(function () {
var instance = this;

// Get resident ID as instance variable, for clarity
instance.residentId = instance.data._id;
const residentId = instance.data.resident._id;

// Create resident activity count reactive variable
instance.residentRecentActiveDaysCount = new ReactiveVar();

// Get resident activity count from server, and set reactive variable
Meteor.call('getResidentRecentActiveDaysCount', instance.residentId, function (error, activeDaysCount) {
Meteor.call('getResidentRecentActiveDaysCount', residentId, function (error, activeDaysCount) {
// set the value of the resident activity count reactive variable
instance.residentRecentActiveDaysCount.set(activeDaysCount);
});
Expand All @@ -21,7 +21,7 @@ Template.homeResident.helpers({
var instance = Template.instance();

// Get resident
const resident = instance.data;
const resident = instance.data.resident;

// Check if resident is on hiatus
if (resident.onHiatus) {
Expand All @@ -47,7 +47,7 @@ Template.homeResident.helpers({
// Map the resident activity level to a Bootstrap class

// Get resident
const resident = instance.data;
const resident = instance.data.resident;

// Check if resident is on hiatus
if (resident.onHiatus) {
Expand Down Expand Up @@ -90,9 +90,9 @@ Template.homeResident.helpers({
});

Template.homeResident.events({
'click .resident': function () {
'click .resident': function (event, templateInstance) {
// Get ID of clicked resident
var residentId = this._id;
const residentId = templateInstance.data.resident._id;

// Show page for clicked resident
Router.go('resident', {residentId: residentId});
Expand Down
45 changes: 45 additions & 0 deletions app/client/views/home/residents/residents.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<template name="homeResidents">
<table class="table table-striped table-compact">
<caption>
{{_ "homeResidents-tableCaption" }}
</caption>
<thead>
<tr>
<th colspan="3"></th>
<th colspan="7">
{{_ "homeResidents-tableHeader-pastWeek" }}
</th>
</tr>
<tr>
<th>
<i class="fa fa-lg fa-user"></i>&nbsp;
{{_ "homeResidents-tableHeader-residentName" }}
</th>
<th>
<i class="fa fa-lg fa-heartbeat"></i>
{{_ "homeResidents-tableHeader-activeDaysCount" }}
</th>
<th>
<i class="fa fa-lg fa-heartbeat"></i>
{{_ "homeResidents-tableHeader-activityLevel" }}
</th>
{{# each day in pastSevenDays }}
<th>{{ abbreviatedWeekday day }}</th>
{{/ each }}
</tr>
</thead>
<tbody>
{{# if residents }}
{{# each resident in residents }}
{{> homeResident resident=resident pastSevenDays=pastSevenDays }}
{{/ each }}
{{ else }}
<tr>
<td>
{{_ "homeResidents-loadingMessage" }}
</td>
</tr>
{{/ if }}
</tbody>
</table>
</template>
25 changes: 25 additions & 0 deletions app/client/views/home/residents/residents.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import d3 from 'd3';
import moment from 'moment';
import 'moment/locale/fi';

Template.homeResidents.helpers({
abbreviatedWeekday (date) {
// Get user language
const locale = TAPi18n.getLanguage();

// Set locale based on user browser language
moment.locale(locale);

// Format the date to display abbreviated weekday in user language
return moment(date).format('dd');
},
pastSevenDays () {
// Get date seven days ago
const sevenDaysAgo = moment().subtract(7, 'days').toDate();

// Get array of past seven days including today
const pastSevenDays = d3.utcDay.range(sevenDaysAgo, new Date());

return pastSevenDays;
}
});
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
6 changes: 4 additions & 2 deletions lib/i18n/en.i18n.json → app/lib/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,11 @@
"homeResidentActivityLevelTrend-legend-inactive": "Inactive",
"homeResidentActivityLevelTrend-legend-semiActive": "Moderate",
"homeResidentActivityLevelTrend-yAxis-label": "Number of residents",
"homeResidents-tableCaption": "Table showing residents. Next to each resident is a count of days with at least one recorded activity within past seven days. Activity level is shown in parenthesis.",
"homeResidents-tableCaption": "Residents table showing count of days with at least one activity, overall activity level, and active days in the past week.",
"homeResidents-tableHeader-residentName": "Name",
"homeResidents-tableHeader-activity": "Recent active days count (activity level)",
"homeResidents-tableHeader-activeDaysCount": "Days",
"homeResidents-tableHeader-activityLevel": "Level",
"homeResidents-tableHeader-pastWeek": "Past week (showing active days)",
"homeResidents-loadingMessage": "Loading residents",
"logout-logoutButton": "Logout",
"newFeeling-cancel": "Cancel",
Expand Down
9 changes: 6 additions & 3 deletions lib/i18n/fi.i18n.json → app/lib/i18n/fi.i18n.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"homeResidents-tableHeader-activeDaysCount": "P\u00e4iv\u00e4t",
"homeResidents-tableHeader-activityLevel": "Taso",
"homeResidents-tableHeader-pastWeek": "Kulunut viikko (n\u00e4ytt\u00e4\u00e4 aktiiviset p\u00e4iv\u00e4t)",
"activities": {
"residentIds": {
"label": "Asukkaat"
Expand Down Expand Up @@ -158,12 +161,12 @@
"homeResidentActivitySummaryChart-residentAxisTitle": "Asukkaan nimi \/ aktiviteettien m\u00e4\u00e4r\u00e4",
"homeResidentActivitySummaryChart-activitiesAxisTitle": "Aktiviteettien m\u00e4\u00e4r\u00e4",
"homeResidentActivityLevelTrend-chartTitle": "Aktiviteettitaso viimeisen seitsem\u00e4n p\u00e4iv\u00e4n ajalta",
"homeResidentActivityLevelTrend-chartDescription": "P\u00e4ivitt\u00e4inen m\u00e4\u00e4r\u00e4 asukkaita, joiden tila on passiivinen, kohtalainen ja erinomainen.",
"homeResidentActivityLevelTrend-chartDescription": "P\u00e4ivitt\u00e4inen m\u00e4\u00e4r\u00e4 asukkaita, joiden aktiviteettitaso on passiivinen, kohtalainen ja erinomainen.",
"homeResidentActivityLevelTrend-legend-active": "Erinomainen",
"homeResidentActivityLevelTrend-legend-inactive": "Passiivinen",
"homeResidentActivityLevelTrend-legend-semiActive": "Kohtalainen",
"homeResidentActivityLevelTrend-yAxis-label": "Asukkaiden lukum\u00e4\u00e4r\u00e4",
"homeResidents-tableCaption": "Asukastaulukko. Jokaisen asukkaan vieress\u00e4 on p\u00e4ivien lukum\u00e4\u00e4r\u00e4, johon on kirjattu v\u00e4hint\u00e4\u00e4n yksi aktiviteetti viimeisten seitsem\u00e4n p\u00e4iv\u00e4n aikana. Aktiviteettitaso sulkeissa.",
"homeResidents-tableCaption": "Asukastaulukko. Taulukko n\u00e4ytt\u00e4\u00e4 niiden p\u00e4ivien lukum\u00e4\u00e4r\u00e4n jolloin asukkaalla on ollut v\u00e4hint\u00e4\u00e4n yksi aktiviteetti, yhteenveto aktiviteettitasosta ja aktiiviset p\u00e4iv\u00e4t viimeisen viikon aikana.\n",
"homeResidents-tableHeader-residentName": "Nimi",
"homeResidents-tableHeader-activity": "Viimeaikaisten aktiviteettien m\u00e4\u00e4r\u00e4 (aktiviteettitaso)",
"homeResidents-loadingMessage": "Ladataan asukkaita",
Expand Down Expand Up @@ -333,4 +336,4 @@
"usersSettings-tableHeaders-edit": "Muokkaa",
"usersSettings-tableHeaders-email": "S\u00e4hk\u00f6posti",
"usersSettings-tableHeaders-roles": "Roolit"
}
}
Loading

0 comments on commit bf80fa8

Please sign in to comment.