-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
315 phase 4 status report #368
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,37 @@ const setSkillCheck = ({user_id, label, checked, referrer}) => | |
} | ||
}) | ||
|
||
const logStatusUpdate = ({user_id, status}) => | ||
knex | ||
.insert({ | ||
occurred_at: knex.fn.now(), | ||
type: 'phase_4_status_update', | ||
user_id, | ||
metadata: {status}, | ||
}) | ||
.into('event_logs') | ||
|
||
|
||
const setStatus = ({user_id, status}) => | ||
logStatusUpdate({user_id, status}) | ||
.then(() => { | ||
const insert = knex('phase_4_status').insert({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this looks good. We really need an |
||
user_id, status, updated_at: knex.fn.now() | ||
}).toString() | ||
|
||
const update = knex('phase_4_status') | ||
.update({status}) | ||
.where('phase_4_status.user_id', user_id) | ||
|
||
const query = util.format( | ||
'%s ON CONFLICT (user_id) DO UPDATE SET %s', | ||
insert.toString(), | ||
update.toString().replace(/^update\s.*\sset\s/i, '') | ||
) | ||
return knex.raw(query) | ||
}) | ||
|
||
module.exports = { | ||
setSkillCheck, | ||
setStatus | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove extra space |
||
exports.up = (knex, Promise) => | ||
knex.schema.createTable('phase_4_status', table => { | ||
table.string('user_id').notNullable().unique() | ||
table.string('status').notNullable() | ||
table.timestamp('updated_at') | ||
}) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. one newline please |
||
|
||
exports.down = (knex, Promise) => | ||
knex.schema.dropTable('phase_4_status') |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,14 @@ | ||
.users | ||
&-status > * | ||
display: inline-block | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are you trying to run things inline horizontally? consider flexbox? |
||
|
||
&-status | ||
margin-bottom: 15px | ||
|
||
&-status-content | ||
font-size: 15px | ||
margin: 0 20px | ||
|
||
&-grid-controls | ||
padding-top: 0.25em | ||
text-align: right | ||
|
@@ -29,3 +39,5 @@ | |
&-grid-member-avatar > img | ||
height: 10vh | ||
min-width: 10vh | ||
&-display-inline | ||
diplay: inline |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
extends ../layout | ||
|
||
block content | ||
mixin usersList(_users) | ||
for user in _users | ||
.users-status | ||
.users-grid-member.well(data-user=JSON.stringify(user)) | ||
a(href='/users/'+user.handle) | ||
.users-grid-member-name= user.name | ||
.users-grid-member-handle= user.handle | ||
.users-grid-member-avatar | ||
img(src=user.avatarUrl) | ||
p.users-status-content= user.status | ||
if userId === user.id | ||
button.btn.btn-primary(type='button' data-toggle='modal' data-target='#statusModal') Update Your Status | ||
.modal.fade#statusModal(role='dialog') | ||
.modal-dialog | ||
.modal-content | ||
.modal-header | ||
button.close(type='button' data-dismiss='modal') × | ||
h4.modal-title Update Your Status | ||
.modal-body | ||
form(action='/phases/4/status' method='post') | ||
textarea(name='status' rows='6' cols='70') | ||
button.btn.btn-default(type='submit') Update | ||
h3 Phase #{phase.number} Status Reports | ||
+usersList(users.filter(u => u.phase === 4)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do this phase 4 filter in the route and remove the mixin in favor of just |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove this and all the changes to this file. i dont think we need them