LjaljevicStefan / GetCommissionDatetime

TEST CODE TASK - Junior Python Django Developer - Remote
0 stars 0 forks source link

Xmas holidays commission. #1

Open Irostovsky opened 2 years ago

Irostovsky commented 2 years ago

Hello @LjaljevicStefan I m Ivan, from GuestReady. Thanks for the doing task. Just one question. Imagine that we want to have the 12% commission in Dec and Jan because of Xmas holidays. How the code should be modified?

LjaljevicStefan commented 2 years ago

Hello @Irostovsky Changes for Xmas holidays commission has been submitted.

Irostovsky commented 2 years ago

@LjaljevicStefan thanks for the update. Unfortunately we can’t go forward with proposed solution. The expected one would be: Define a dict with month_number: commission. Ie {1: 0.12, 2: 0.1, …. } then just get the commission from dict by month of the passed date. The solution fixes 2 major issues: there is no need to change a function code when the commission is changed for some particular month. And preventing magic numbers anti-pattern in code. So data and logic are splitted.

LjaljevicStefan commented 2 years ago

Thank you for getting back to me, that solution didn't occur to me because in first task it didn't mention that there would be a lot of changes on commission factor, but now when you mention dict, it is more logical solution.

On Mon, 4 Apr 2022, 22:27 Ivan Rostovsky, @.***> wrote:

@LjaljevicStefan https://github.com/LjaljevicStefan thanks for the update. Unfortunately we can’t go forward with proposed solution. The expected one would be: Define a dict with month_number: commission. Ie {1: 0.12, 2: 0.1, …. } then just get the commission from dict by month of the passed date. The solution fixes 2 major issues: there is no need to change a function code when the commission is changed for some particular month. And preventing magic numbers anti-pattern in code. So data and logic are splitted.

— Reply to this email directly, view it on GitHub https://github.com/LjaljevicStefan/GetCommissionDatetime/issues/1#issuecomment-1087981958, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXGVKPLHQ5FS4S2JG6MFHMTVDNGB3ANCNFSM5SP63Y2Q . You are receiving this because you were mentioned.Message ID: @.***>

Irostovsky commented 1 year ago

Yep, the task was with this small trick especially. Then I have given the tip(Xmas) that should help to resolve it in a more less right way.

On 4 Apr 2022, at 23:48, LjaljevicStefan @.***> wrote:

 Thank you for getting back to me, that solution didn't occur to me because in first task it didn't mention that there would be a lot of changes on commission factor, but now when you mention dict, it is more logical solution.

On Mon, 4 Apr 2022, 22:27 Ivan Rostovsky, @.***> wrote:

@LjaljevicStefan https://github.com/LjaljevicStefan thanks for the update. Unfortunately we can’t go forward with proposed solution. The expected one would be: Define a dict with month_number: commission. Ie {1: 0.12, 2: 0.1, …. } then just get the commission from dict by month of the passed date. The solution fixes 2 major issues: there is no need to change a function code when the commission is changed for some particular month. And preventing magic numbers anti-pattern in code. So data and logic are splitted.

— Reply to this email directly, view it on GitHub https://github.com/LjaljevicStefan/GetCommissionDatetime/issues/1#issuecomment-1087981958, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXGVKPLHQ5FS4S2JG6MFHMTVDNGB3ANCNFSM5SP63Y2Q . You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.