Skip to content

Commit

Permalink
Log is working pretty well
Browse files Browse the repository at this point in the history
  • Loading branch information
etousley committed Aug 14, 2017
1 parent 0e64ab8 commit 2f37a05
Show file tree
Hide file tree
Showing 6 changed files with 254 additions and 149 deletions.
6 changes: 3 additions & 3 deletions controllers/logEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ const lookups = require('../public/js/lookups.js');
* Return activityDefinitions object
*/
exports.getActivityDefinitions = (req, res) => {
res.send(lookups.activityDefinitions);
res.send(lookups.activitiesSortedAlpha);
};


/**
* Calculate points based on activity and duration
*/
calculateActivityPoints = (logEntry) => {
const activityDefinition = lookups.activityDefinitions[logEntry.activity];
const activityDefinition = lookups.activitiesSortedAlpha[logEntry.activity];
console.log(JSON.stringify(logEntry));

// Is it the right time unit?
Expand All @@ -42,7 +42,7 @@ exports.getLog = (req, res) => {
title: 'My Log',
user: req.user,
logOwner: {email: req.url.split("/").slice(-1)[0]},
activities: lookups.activityDefinitions
activities: lookups.activitiesSortedAlpha
});
};

Expand Down
7 changes: 5 additions & 2 deletions models/LogEntry.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@

const mongoose = require('mongoose');
const lookups = require('../public/js/lookups');
const activityNames = Object.keys(lookups.activityDefinitions);


const logEntrySchema = new mongoose.Schema({
user: { type: String, required: true }, // User's email address
date: { type: Date, required: true },
activity: { type: String, required: true },
// category: { type: String, required: true },
durationUnit: { type: String, required: true },
durationUnit: { type: String, required: true, enum: activityNames },
durationValue: { type: Number, required: true },
points: Number,
title: {type: String},
title: String,
description: String
}, { timestamps: true });

Expand Down
24 changes: 16 additions & 8 deletions public/css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ footer {
}
}

.vert-spaced-sm {
margin-top: 3px;
margin-bottom: 3px;
.vert-spaced {
margin-top: 8px;
margin-bottom: 8px;
}

// Input Fields
Expand Down Expand Up @@ -80,22 +80,26 @@ textarea {
padding-top: 2em;
resize: both;
overflow: auto;
cursor: pointer;
}

.fc-day {
cursor: pointer;
// Hack to treat .fc-day:hover and .fc-day-top:hover the same way with JS
.fc-day.active {
background-color: #d9edf7 !important;
}

.fc-day:hover {
background-color: #d9edf7;
.fc-day-number {
cursor: auto;
}

.fc-day-top {
cursor: pointer;
// border-bottom: 1px dotted #eaeaea !important;
// May need to use JS listener to get hover behavior to match .fc-day:hover
}

.fc-row .fc-content-skeleton {
cursor: pointer;
cursor: auto;
}

.fc .log-entry-btn {
Expand Down Expand Up @@ -126,6 +130,10 @@ textarea {
float: right;
}

.entry-activity-field > .caret {
margin-left: 1em;
}

// .entry-duration-value-input {
// max-width: 100px;
// }
Loading

0 comments on commit 2f37a05

Please sign in to comment.