Skip to content

Commit

Permalink
Add Purchase heatmap (#352)
Browse files Browse the repository at this point in the history
* Added mockup heatmap to user-page.

* Updated mockup to better reflect target html.

* Added empty functions for acquiring and transforming heatmap data.

* Proper generation of mockup data in method. Partially finished transformation of data.

* Finished replacing mockup with HTML generated using django templates.

* Removed outer div, and removed commented code.

* Finished logic for retrieving latest purchases and transforming it.

* Reformatted and removed redundant imports

* Corrected off-by-one error in day rendering. Finished database queryies for now.

* Reformatted code using black

* Finished implementing database lookup! Basic heatmap functionality is finished.

* Inverse filtering

* Removed mockup function

* moved heatmap logic into separate file

* Moved remaining function to separate file, and added typing

* Prepared table to support multiple color modes

* Finished multiview, and added general view, and figure description

* Temporarily added heatmap testdata

* Made general-view the primary view, and improved template code. Removed redundant dependency in views.py

* Inverted brightness, to make darker colors show more activity. Offset general by 1 to avoid black squares.

* Swapped figure button text, to display the next mode instead of current.

* Partially finished abstracting heatmap color modes

* Finished abstracting heatmap color modes. Added separate buttons for each mode instead of cycling.

* Proposed solution for displaying purchased products

* Removed iter from query loop

* Selects related product field immediately instead of making duplicate queries

* Improved appearance

* Made product count appear whenever mouse enters figure. Styled number to look consistent.

* Finished money-used color mode. Made title show current mode selected. Refactored heatmap code.

* Improved interactivity by adding day summaries, every day now shows the total, e.g. money spent that day for money-sum.

* Fixed crash on rendering other than 10 weeks

* Resolved crash on empty heatmap. Corrected week numbers on new year wrap.

* "Vare" vs. "varer"

* Added RGB interpolation for color values.

* test

* test

* dummy change to trigger CI

* Revert "dummy change to trigger CI"

This reverts commit 241ccbd.

* fixup py versions

* add caching to build

* nop

* nop

* try reverting action-version

* nop

* Abstracted heatmap preparation into new method.

* Made a few tests. Need to improve further.

* Finished tests

* Removed color brightness from category heatmap

* Displays 12 weeks default, as it corresponds to last 3 months

* Reorganized code, removed some comments, and added docstring

* Whoops. Should work now.

* Resolved bug for when a purchased product isn't in the table anymore, but is in history.

* Test errors interpret now as well

* Updated fixture

* Changed event listening method

* Resolved nested loops

* Resolved issue (my laptop setup is non-optimal)

* Reduced category/product lookup from 6 queries to 3.

* Refactored function names, and corrected typing

* Changed the colors on the category chart, to (kind of) make it better to look at

* Black formatter

---------

Co-authored-by: falkecarlsen <11318702+falkecarlsen@users.noreply.github.com>
  • Loading branch information
krestenlaust and falkecarlsen authored Sep 30, 2023
1 parent 7b604a0 commit 46d63d6
Show file tree
Hide file tree
Showing 7 changed files with 1,454 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
python-version: ["3.6.9", "3.7.17", "3.11.5"] # 3.6.9 is what is running on prod

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand Down
Loading

0 comments on commit 46d63d6

Please sign in to comment.