MirkoMilanovic / Commission_Web_Application

This Django application has: Upload page (load the reservations CSV, save the data into the DB), Report page (with all loaded reservations, total company commission amount, company commission per month), City_commission page (total commission amount for the chosen city).
0 stars 0 forks source link

Review #1

Open CatalinAtanase opened 2 years ago

CatalinAtanase commented 2 years ago

Hello, thank you for doing this task. I will add some notes and please make a pull request for this.

The app name should usually be the main model name but using plural eg reservations. For this one I think we can continue with your app name.

admin.py

@Irostovsky

templates:

about testing, django uses unittest already using a class based approach. see https://docs.djangoproject.com/en/4.0/topics/testing/overview/

cc @Irostovsky

MirkoMilanovic commented 2 years ago

Hello Catalin, thank you for your review and for the good notes given!

I did correct most stuff, but some ORM queries don't work as expected. So I left the old solution there for now. For example, I have tried something like this:

total_commission = Reservation.objects.filter(city__in=COMMISSION_RATES.keys()).annotate(instance_commission=F('net_income') * COMMISSION_RATES.get(F('city')) / 100).aggregate(total_commission=Sum('instance_commission'))['total_commission']

or many different variations like so, but it doesn't work. Maybe I can get some tips about that or some more time to investigate and work on that.

Thank you, and have a nice weekend! Mirko Milanovic

MirkoMilanovic commented 2 years ago

Hello @CatalinAtanase I did upload the solution afterwards. It seems way better and more professional now!

Thank you and Happy Easter! Mirko Milanovic