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

Create report types #304

Closed
wants to merge 1 commit into from
Closed

Conversation

lpichler
Copy link
Contributor

alternative of #209:

Taken from @hstastna's description:
What:
We need to store the type of the Rate which is related to type of Report: Chargeback for VMs/Images/Projects.

Why:
We need it for adding new drop down to editing screen for Rate to be able to choose the type of the rate and then to display only appropriate columns of the rate, based on the chosen type of the rate (VMs, Images, Projects).

I added selected option 2 #209 (comment) option after our discussion.

The only difference is that I created more general table ReportType - even If I don't have other use case at this moment.

ReportType is new one.
screenshot 2018-11-14 at 19 54 55

cc @gtanzillo @carbonin @hstastna

Links

https://bugzilla.redhat.com/show_bug.cgi?id=1581817

@miq-bot
Copy link
Member

miq-bot commented Nov 14, 2018

Checked commit lpichler@debbcd3 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 1 offense detected

db/migrate/20181107164348_create_report_type.rb

@@ -0,0 +1,11 @@
class CreateReportType < ActiveRecord::Migration[5.0]
def change
create_table :report_types do |t|
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure report_types is the best name here. Maybe reportable_fields?

This table will store one row per entry in https://github.com/lpichler/manageiq/blob/ce3bb5dc39eb168a70a9f6be73ed496cb5dc6c22/app/models/chargeback_vm.rb#L2 right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

first usage, is for ChargeableField. One row of ChargeableField could have 2 chargeback report types. For example, v_derived_cpu_total_cores_used belongs to ChargebackContainerImage, ChargebackContainerProject chargeback report types.

So firstly I was modeling:

ChargeableField has_many ChargebackReportType and then
I realized that probably it could be useful to don't limit ourselves and go with general way:

ChargeableField has_many ReportType

due this facts, I think that name reportable_fields doesn't explain the idea of intended report types. But as my native language is not english - I could be wrong :)

what do you think now?

thanks!

Copy link
Member

Choose a reason for hiding this comment

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

I'm still not sure what the resource is pointing to in that case? If its something inheriting from Chargeback then there won't be a database row, but if it's ChargeableField then why make it polymorphic?

@carbonin
Copy link
Member

Also, I'm curious about why something like ChargebackVm.attribute_names wouldn't satisfy this requirement ("I need all the fields that apply to a particular type of chargeback report").

Is that something we considered over editing the schema?

@lpichler
Copy link
Contributor Author

lpichler commented Apr 2, 2019

closing for, we have other solution

@lpichler lpichler closed this Apr 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants