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
Conversation
export enum Status { | ||
Confirmed = 'confirmed', | ||
Confirmed = 'active', |
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.
Confirmed !== active
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.
My bad 😞
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.
@danbilokha Do you say I'm showing wrong data to user
OR I just need to rename Enum for consistancy?
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.
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); |
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.
what if it's in message.text
?
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.
Let's discuss offline, cause I've prolly misunderstund the architecture
@@ -1,7 +1,7 @@ | |||
export const addDays = (date: string | Date, days: number) => { | |||
export const addDays = (date: string | Date, days: number): Date => { |
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.
thanks 👍 really appreciate typings
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.
Types
Types
Types
Types
Types
Types
kript
kript
kript
kript
kript
kript
|
||
export const trendsByCountryResponse: CallBackQueryHandlerWithCommandArgument = async ( | ||
bot: TelegramBot, | ||
message: TelegramBot.Message, | ||
chatId: number, | ||
requestedCountry?: string | undefined | ||
requestedCountry?: string | undefined, | ||
requestedFrequency?: Frequency | undefined |
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.
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 :)
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.
@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
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.
just told you how it works so you were aware of that.
}; | ||
|
||
const capitalize = (input: string): string => |
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.
that function should go to utils
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.
Lovely utils
@@ -190,6 +190,39 @@ export const withSingleParameterAfterCommand = ( | |||
}; | |||
}; | |||
|
|||
export const withTwoArgumentsAfterCommand = ( |
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.
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
);
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.
let me know if you want to brainstorm on that together
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.
also, be aware, that from now these FNs have there own files (because of testing framework)
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.
Brainstorm IS COMMING
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.
done
? 'Whole period' | ||
: capitalize(requestedFrequency); | ||
|
||
let model = enrichWithTitle( |
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.
is that really a model? Maybe a chart? Does it have a type?
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.
Types
Types
Types
Types
Types
Types
kript
kript
kript
kript
kript
kript
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.
@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
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.
@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
3b61802
to
e443e4c
Compare
ikCbData?: string | ||
): Promise<TelegramBot.Message> => { | ||
try { | ||
const [arg1, arg2] = splitArgument(ikCbData); |
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.
talked
monthly, weekly and whole period charts are now available within country command inline keboard