Skip to content
This repository has been archived by the owner on Nov 23, 2019. It is now read-only.

Add more reports to timebot #184

Merged
merged 9 commits into from Feb 22, 2017
Merged

Add more reports to timebot #184

merged 9 commits into from Feb 22, 2017

Conversation

gnarf
Copy link
Contributor

@gnarf gnarf commented Feb 17, 2017

image
image

project.short_code,
to_char(date_trunc('week', timesheet.day), 'YYYY-MM-DD') as week,
extract(epoch from sum(timesheet.duration)) / 3600 as hours,
string_agg(timesheet.notes, '; '::text) as notes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you have to cast this to text here? just curious

@@ -0,0 +1,12 @@
SELECT
project.short_code,
to_char(date_trunc('week', timesheet.day), 'YYYY-MM-DD') as week,
Copy link
Contributor

@tkellen tkellen Feb 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you do date(timesheet.day)::text?

`${Number(time).toFixed(2)}h`;

// target - current is "positive" when current < target (which is a negative thing)
const emoji = val =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is kinda gross but i get it :p

behind,
ratio,
}) =>
`\`${code}${' '.repeat(10 - code.length)} [${histogramByPercentage(10, ratio)}\`${emoji(behind)}\`${histogramByPercentage(5, ratio - 1)}] ${` ${Math.round(ratio * 100)}`.slice(-3)}% c:${duration(current)} t:${duration(target)} a:${duration(avg)}\`${emoji(target - avg)}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we lift this into a named function and call it?

behind,
ratio,
}) => {
// use short variables to make the template be one line
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 zillion times better!

@tkellen tkellen merged commit c566e33 into master Feb 22, 2017
@tkellen tkellen deleted the timebot branch February 22, 2017 22:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants