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

Feature/creating calculators constructor #534

Open
wants to merge 73 commits into
base: develop
Choose a base branch
from

Conversation

AndriyAndriyovuch
Copy link
Contributor

@AndriyAndriyovuch AndriyAndriyovuch commented Jul 31, 2023

Code reviewers

Summary of issue

Create calculator's constructor

Summary of change

  • created new controllers for calculator (api and regular)
  • added new services and validator
  • created new stimilus controller
  • fixed relations between models
  • wrote new views in erb for calculators
  • fixed all old tests for new functionality
  • add addictional tests for new functionality
  • create seeds for creating calculator with related objects
_.ZeroWaste.webm

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

@AndriyAndriyovuch AndriyAndriyovuch self-assigned this Jul 31, 2023
@render
Copy link

render bot commented Jul 31, 2023

@AndriyAndriyovuch AndriyAndriyovuch marked this pull request as draft July 31, 2023 17:25
@AndriyAndriyovuch AndriyAndriyovuch linked an issue Jul 31, 2023 that may be closed by this pull request
14 tasks
@@ -1,15 +1,20 @@
# frozen_string_literal: true

class Account::CalculatorsController < Account::BaseController
before_action :calculator, only: [:edit, :update, :destroy]
before_action :calculator, only: [:show, :edit, :update, :destroy]
Copy link
Collaborator

Choose a reason for hiding this comment

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

що це і звідки?

end
end

def products_collection
Product.all
Copy link
Collaborator

Choose a reason for hiding this comment

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

а де сортування?

end

def product_resource
Product.find(@calculator.product_id)
Copy link
Collaborator

Choose a reason for hiding this comment

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

чому не з колекшина?

@@ -0,0 +1,5 @@
class AddProductIdToCalculators < ActiveRecord::Migration[6.1]
def change
add_column :calculators, :product_id, :integer
Copy link
Collaborator

Choose a reason for hiding this comment

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

reference

@codecov
Copy link

codecov bot commented Aug 6, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.90%. Comparing base (3bff2f0) to head (0bca812).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #534      +/-   ##
===========================================
- Coverage    91.16%   90.90%   -0.27%     
===========================================
  Files           70       73       +3     
  Lines          973     1011      +38     
===========================================
+ Hits           887      919      +32     
- Misses          86       92       +6     

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

Comment on lines 14 to 26
<%= form.input_field :period,
collection: use_period,
prompt: '__',
class: 'form_fild price_select rounded w-100',
data: { calculate_target: 'period' } %>

<%= t("calculators.form.price") %>
<%= form.input_field :product_category,
collection: product_prices(@calculator),
prompt: '__',
label: t('.form_price'),
class: 'form_fild price_select rounded w-100',
data: { calculate_target: 'priceCategory' } %>
Copy link
Collaborator

Choose a reason for hiding this comment

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

а чому не просто form.input?

Copy link
Contributor

Choose a reason for hiding this comment

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

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Priority: high
Projects
None yet
4 participants