Skip to content

Add params for startDate, endDate and calculation of all recorded hours.#89

Open
tuomastanner wants to merge 1 commit into
masterfrom
custom-range-and-weekends
Open

Add params for startDate, endDate and calculation of all recorded hours.#89
tuomastanner wants to merge 1 commit into
masterfrom
custom-range-and-weekends

Conversation

@tuomastanner

Copy link
Copy Markdown

No description provided.

@tuomastanner tuomastanner requested a review from lauravuo March 19, 2019 12:41

@lauravuo lauravuo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The slack integration will most likely be broken due the new params being undefined.

Comment thread src/app/index.js
logger.info(`Total working hours from range start ${totalHours}`);

const result = analyzer.calculateWorkedHours(range.entries);
const result = analyzer.calculateWorkedHours(range.entries, !!calcAll);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Double negation?

Comment thread src/index.js
if (userId) {
logger.info(`Fetching data for user id ${userId}`);
const email = request.email || await slack.getUserEmailForId(userId);
const { startDate, endDate, calcAll } = request;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

These will be always undefined since they are not parsed from command.

Comment thread src/cli/index.js
logger.info(`Calculating flextime for ${email}`);
const data = await app.calcFlextime(email);
const calcFlexTime = async (email, startDate, endDate, calcAll) => {
logger.info(`Calculating flextime for ${email} ${startDate} ${endDate} ${calcAll ? 'all hours included' : ''}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

calcAll? What is the purpose, !calcAll counts also hours marked on public holidays? Should you define a default value that is aligned with previous functionality?

Originally ignoring of public holidays was implemented on purpose, since a lot of people recorded hours afterwards and entered working hours also to public holidays which mixed up the billable hours calculation. So I probably wouldn't allow people marking hours on public holidays.

Comment thread src/app/analyzer/index.js

return {
entries: sortedRangeEntries,
start: startDate || new Date(sortedRangeEntries[0].date),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Changed on purpose? sortedEntries -> sortedRangeEntries

Comment thread src/cli/index.js
.action(generateStats);
program
.command('flextime <email>')
.command('flextime <email> [startDate] [endDate] [calcAll]')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Describe params in cli help text. Update README with relevant parts.

@buggedcom

Copy link
Copy Markdown

@tuomastanner Can we abandon this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants