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

Fix #1030. Display volunteer count on home page #1036

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

jerinisready
Copy link

@jerinisready jerinisready commented Aug 10, 2019

COMMIT ensures there is no breaking in design or working of the application.

CHANGES

Date: Sat Aug 10 12:47:58 2019 +0530
On branch 2019/jerinisready/issue_fix

Changes to be committed:

  • modified: mainapp/models.py
  • modified: mainapp/views.py
  • modified: static/css/style.css
  • modified: templates/base.html
  • modified: templates/home.html
  • modified: templates/ngo_volunteer.html

Issue Reference

This PR addresses the Issue: Fixes #1030

Summarize

Added badges to cards which shows count of active items in that section.

Updations

  • mainapp/models.py - added classmethods for models to get count with neet filtering where required.

  • mainapp/views.py - caching and passing required counts as context

  • static/css/style.css - reformated style as per standards with auto intent in Pycharm;
    - added styles for badge in card
    - added a fair border for from.

  • templates/home.html - added {% block title %} to provide title inherritance

  • templates/home.html - added badges for each card.

  • templates/ngo_volunteer.html - added badges for each card showing volunteer intivudial count and ngo count.

OPTIMIZATIONS.
  * Usage of Redis cache to avoid DB hits first hit strike 12 querys to get data. 

After caching on first hit, it take none until cache expiry.
* Ease Disconnection of changes in this commit from settings.

CONFIGURATIONS.
HOME_PAGE_ANALYTICS = {
    'DISPLAY': True,
    'INVALIDATION_LOGIC': 'TIMEOUT',        # options : ["TIMEOUT", "ON_CREATE"] ## ON_CREATE is accurate but expensive for drastic write COUNT.
    'TIMEOUT': 60 * 40,                     # DEFAULTS TO 40 MINUTE.
    'HOME_PAGE_CACHE_KEY': 'home_page_data_statics',
    'VOLUNTEER_CACHE_KEY': 'ngo_data_statics',
}
while coding reviews
  • settings.HOME_PAGE_ANALYTICS['DISPLAY'] = True will enable the changes which makes the changes shown as in the images. Turning it off will make everything working normal.

  • settings.HOME_PAGE_ANALYTICS['INVALIDATION_LOGIC'] = 'TIMEOUT' will invalidate cache in settings.HOME_PAGE_ANALYTICS['TIMEOUT'] seconds which is default to 40 minutes.

  • settings.HOME_PAGE_ANALYTICS['INVALIDATION_LOGIC'] = 'ON_CREATE' will be eager mode which invalidates cache to get most up to date result, which invalidates cache on every creation in specific tables.

  • settings.HOME_PAGE_ANALYTICS['HOME_PAGE_CACHE_KEY'] = 'home_page_data_statics' makes redis key to store values for home page counts .

  • settings.HOME_PAGE_ANALYTICS['VOLUNTEER_CACHE_KEY'] = 'ngo_data_statics' makes redis key to store values for volunteer data counts .

new_home

COMMIT ensures there is no breaking in design or working of the application.

CHANGES
=======

Added badges to cards which shows count of active items in that section.

Date:      Sat Aug 10 12:47:58 2019 +0530
On branch 2019/jerinisready/issue_fix
Changes to be committed:
	modified:   mainapp/models.py
	modified:   mainapp/views.py
	modified:   static/css/style.css
	modified:   templates/base.html
	modified:   templates/home.html
@dauntlessnomad dauntlessnomad requested review from biswaz and vigneshhari and removed request for biswaz August 10, 2019 10:35
mainapp/views.py Outdated Show resolved Hide resolved
@biswaz biswaz changed the title 2019/jerinisready/issue fix Fix #1030. Display volunteer count on home page Aug 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display volunteer count on homepage
3 participants