Skip to content
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

Improve charts partially resolves #80 #91

Merged
merged 8 commits into from Apr 22, 2020
Merged

Improve charts partially resolves #80 #91

merged 8 commits into from Apr 22, 2020

Conversation

Proladge
Copy link
Collaborator

monthly, weekly and whole period charts are now available within country command inline keboard

@Proladge Proladge added the enhancement New feature or request label Apr 20, 2020
@Proladge Proladge added this to the release 3 milestone Apr 20, 2020
@Proladge Proladge self-assigned this Apr 20, 2020
export enum Status {
Confirmed = 'confirmed',
Confirmed = 'active',
Copy link
Owner

Choose a reason for hiding this comment

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

Confirmed !== active

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My bad 😞

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@danbilokha Do you say I'm showing wrong data to user
OR I just need to rename Enum for consistancy?

Copy link
Owner

Choose a reason for hiding this comment

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

rename for consistency, I am not sure how you use that for showing the data

ikCbData?: string
): Promise<TelegramBot.Message> => {
try {
const [arg1, arg2] = splitArgument(ikCbData);
Copy link
Owner

Choose a reason for hiding this comment

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

what if it's in message.text?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Let's discuss offline, cause I've prolly misunderstund the architecture

server/src/bots/telegram/index.ts Show resolved Hide resolved
@@ -1,7 +1,7 @@
export const addDays = (date: string | Date, days: number) => {
export const addDays = (date: string | Date, days: number): Date => {
Copy link
Owner

Choose a reason for hiding this comment

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

thanks 👍 really appreciate typings

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Types
Types

Types

Types

Types

Types

kript

kript

kript

kript

kript
kript

server/src/services/domain/chart.ts Show resolved Hide resolved
server/src/services/domain/chart.ts Show resolved Hide resolved
server/src/services/domain/chart.ts Outdated Show resolved Hide resolved

export const trendsByCountryResponse: CallBackQueryHandlerWithCommandArgument = async (
bot: TelegramBot,
message: TelegramBot.Message,
chatId: number,
requestedCountry?: string | undefined
requestedCountry?: string | undefined,
requestedFrequency?: Frequency | undefined
Copy link
Owner

Choose a reason for hiding this comment

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

I know that you just followed the pattern, but I recently realized that It means
requestedFrequency might be present and might not
AND
when it presents it could be Frequency and could be undefined.

If that's interned, then go for that :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@danbilokha
Could you please paste what I should do with it?
Are you saying that undefined is redundant?
And I should remove it to be requestedFrequency?: Frequency

Copy link
Owner

Choose a reason for hiding this comment

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

just told you how it works so you were aware of that.

server/src/bots/telegram/botResponse/trendResponse.ts Outdated Show resolved Hide resolved
};

const capitalize = (input: string): string =>
Copy link
Owner

Choose a reason for hiding this comment

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

that function should go to utils

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Lovely utils

@@ -190,6 +190,39 @@ export const withSingleParameterAfterCommand = (
};
};

export const withTwoArgumentsAfterCommand = (
Copy link
Owner

Choose a reason for hiding this comment

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

if you could integrate it with the previous approach it would be great
and it would be great if it were generic


handlerFn.call(
                this,
                bot,
                message,
                chatId,
                ...parameters
            );

Copy link
Owner

Choose a reason for hiding this comment

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

let me know if you want to brainstorm on that together

Copy link
Owner

Choose a reason for hiding this comment

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

also, be aware, that from now these FNs have there own files (because of testing framework)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Brainstorm IS COMMING

Copy link
Owner

Choose a reason for hiding this comment

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

done

? 'Whole period'
: capitalize(requestedFrequency);

let model = enrichWithTitle(
Copy link
Owner

Choose a reason for hiding this comment

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

is that really a model? Maybe a chart? Does it have a type?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Types
Types

Types

Types

Types

Types

kript

kript

kript

kript

kript
kript

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@danbilokha
There is no need to add any type there.
TypeScript is clever enough to identify and follow the type by return type of the function

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@danbilokha try to hover your mouse on the variable. And you'll see the macig.
I know I promised to provide with a nice article on that point.
But so far I've just found. this
image

ikCbData?: string
): Promise<TelegramBot.Message> => {
try {
const [arg1, arg2] = splitArgument(ikCbData);
Copy link
Owner

Choose a reason for hiding this comment

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

talked

@Proladge Proladge merged commit 27f32b6 into master Apr 22, 2020
@Proladge Proladge deleted the improve-charts branch April 22, 2020 17:40
@danbilokha danbilokha linked an issue Apr 22, 2020 that may be closed by this pull request
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
COVID-19
Awaiting triage
Development

Successfully merging this pull request may close these issues.

Charts
2 participants