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

Save previous calculations of the user in the storage #993

Open
wants to merge 5 commits into
base: calculators-constructor
Choose a base branch
from

Conversation

SleekMutt
Copy link
Contributor

@SleekMutt SleekMutt commented Nov 29, 2024

unknown_2024.11.29-15.51.mp4

solves #990

Code reviewers

Summary of issue

Users calculations must be saved in the storage

Summary of change

Added feature to save previous results in the session storage

CHECK LIST

  • СI passed
  • Сode coverage >=95%
  • PR is reviewed manually again (to make sure you have 100% ready code)
  • All reviewers agreed to merge the PR
  • I've checked new feature as logged in and logged out user if needed
  • PR meets all conventions

Copy link

codecov bot commented Nov 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.05%. Comparing base (679ae88) to head (74953cb).
Report is 2 commits behind head on calculators-constructor.

Additional details and impacted files
@@                     Coverage Diff                     @@
##           calculators-constructor     #993      +/-   ##
===========================================================
+ Coverage                    86.74%   87.05%   +0.30%     
===========================================================
  Files                           68       68              
  Lines                         1056     1058       +2     
===========================================================
+ Hits                           916      921       +5     
+ Misses                         140      137       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

app/controllers/calculators_controller.rb Show resolved Hide resolved

<%= turbo_frame_tag "calc-results" %>
<%= turbo_frame_tag "calc-results" do %>
<% if session.dig(:calculation_results, @calculator.slug)&.presence %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<% if session.dig(:calculation_results, @calculator.slug)&.presence %>
<% if session.dig(:calculation_results, @calculator.slug).present?%>

@SleekMutt SleekMutt linked an issue Dec 1, 2024 that may be closed by this pull request
@SleekMutt SleekMutt added the enhancement New feature or request label Dec 1, 2024
@SleekMutt SleekMutt self-assigned this Dec 1, 2024
<%= turbo_frame_tag "calc-results" %>
<%= turbo_frame_tag "calc-results" do %>
<% if session.dig(:calculation_results, @calculator.slug).present? %>
<%= render "calculators/partials/calculation_results", results: session[:calculation_results][@calculator.slug].map(&:symbolize_keys) %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. use with_indifferent_access
  2. use dig

@loqimean
Copy link
Collaborator

loqimean commented Dec 1, 2024

  1. solve conflicts
  2. request team review, as it is required
  3. attach project to this PR

@SleekMutt SleekMutt requested a review from ktpe December 1, 2024 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Ready for review
Development

Successfully merging this pull request may close these issues.

Saving a previous result in LocalStorage
3 participants