-
Notifications
You must be signed in to change notification settings - Fork 4
Overdue tasks page #89
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
Open
FrankieFabuloso
wants to merge
7
commits into
master
Choose a base branch
from
overdueTasksPage
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
510134f
WIP- issue #76, adds a WIP OverdueTasksDashboard component
032fba4
Merge remote-tracking branch 'origin/overdueTasksPage' into overdueTa…
thamaranth ec81203
WIP Overdue tasks
thamaranth 856e2df
WIP OverdueTasks
thamaranth d152dbc
Merge branch 'master' into overdueTasksPage
39e5483
Resolves issue (#76). Adds view for all over due tasks
59ab0de
finalized OverdueTasks component
thamaranth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,3 @@ | ||
| td{ | ||
| max-width: 600px; | ||
| } |
This file contains hidden or 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,97 @@ | ||
| import React, { Component } from 'react' | ||
| import {fetchURL, toStandardDate } from '../../../common/utils' | ||
| import moment from 'moment' | ||
| import styles from './index.css' | ||
|
|
||
| export default class OverdueTaskList extends Component { | ||
| constructor (props) { | ||
| super(props) | ||
| this.state = { | ||
| tasks:[] | ||
| } | ||
| } | ||
|
|
||
| componentDidMount(){ | ||
| fetchURL('api/task/tasksAndUsers') | ||
| .then(results => { | ||
| this.setState({ | ||
| tasks: results.filter(this.isOverdue), | ||
| }) | ||
| }) | ||
| .catch(err => { | ||
| return err | ||
| }) | ||
| } | ||
|
|
||
|
|
||
| findEmailByUUID( user_id ){ | ||
| for( let task of this.state.tasks ){ | ||
| if( task.user_id == user_id ){ | ||
| if(task.email !== null) { | ||
|
Collaborator
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. these 2 if statements can be combined |
||
| return ( | ||
| <a href={`mailto:${task.email}`}> | ||
| {task.github_handle} | ||
| </a> | ||
| ) | ||
| } else { | ||
| return task.github_handle | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| isOverdue(task){ | ||
| if (moment().isAfter(task.due_date) && task.is_complete === false){ | ||
| return true | ||
| } | ||
| } | ||
|
|
||
| daysOverdue(task_due_date) { | ||
| let diffInDays = Math.abs(moment(task_due_date).diff(moment(), 'days')) | ||
|
|
||
| return ( | ||
| <span className="label label-danger">Overdue By: {diffInDays} days</span> | ||
| ) | ||
| } | ||
|
|
||
| render() { | ||
| return ( | ||
| <div className='panel panel-info'> | ||
| <div className='panel-heading'> | ||
| <div className='panel-title'>Overdue Tasks</div> | ||
| </div> | ||
| <div className='panel-body'> | ||
| <div className='list-group'> | ||
| <table className='table'> | ||
| <thead> | ||
| <tr> | ||
| <th> GitHub Handle </th> | ||
| <th> Title </th> | ||
| <th> Description </th> | ||
| <th> Days Overdue </th> | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| {this.state.tasks.map(task => | ||
| <tr key={task.id}> | ||
| <td> | ||
| {this.findEmailByUUID(task.user_id)} | ||
| </td> | ||
| <td> | ||
| {task.title} | ||
| </td> | ||
| <td> | ||
| {task.description} | ||
| </td> | ||
| <td> | ||
| {this.daysOverdue(task.due_date)} | ||
| </td> | ||
| </tr>)} | ||
| </tbody> | ||
| </table> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ) | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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,18 @@ | ||
| import React, { Component } from 'react' | ||
| import OverdueTaskList from '../../molecules/OverdueTaskList/index' | ||
| import { fetchURL, toStandardDate } from '../../../common/utils' | ||
| import moment from 'moment' | ||
|
|
||
| export default class OverdueTask extends Component { | ||
|
|
||
| render() { | ||
| return ( | ||
| <div className='container'> | ||
| <div> | ||
| <h1>Overdue Tasks</h1> | ||
| </div> | ||
| <OverdueTaskList/> | ||
| </div> | ||
| ) | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
why does this function exist? Since you are now fetching the task, and the associated user of the task(by joining the task and user table), the email should be a property on the task object.