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

E1455, Refactoring the Chart helper #439

Merged
merged 16 commits into from
Dec 11, 2014
Merged

Conversation

noelmathew
Copy link
Contributor

What it does:

  1. This helper/chart class provides the templates of data. It also has pie diagrams and charts for the data.
  2. Also contains fixes to display bar, line and pie charts.

]
@available_data_types[:line] = []
@available_data_types[:pie] = []
end

Choose a reason for hiding this comment

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

The code does not have comments explaining what it does. Please add comments to the code.

}
},
def self.get_pie_template()
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you place this data in a YAML file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could you clarify on this? As per our understanding, these changes create a basic template with dummy values which then get replaced by the data variable being passed in the initialize call.
I believe the original developers kept these values there to show future developers how the values should be for the chart to work.
I was under the impression that yaml files are used for doing environment specific configuration things.

Copy link
Contributor

Choose a reason for hiding this comment

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

Generally, it is preferred to segregate different formats (i.e. ruby, html, javascript, etc.). Raw data is no exception. The configuration files in Rails such as database.yml are used directly in Ruby to access the associated information without cluttering the ruby code (Expertiza::Application.config.database_configuration[Rails.env], for example). You can load an individual file like so: YAML.load_file('config/database.yml'). It may be wise to create a config/charts directory which contains files such as bar.yml, pie.yml, etc.

Your second concern about readability is a good one. YAML is, in fact, designed to be human-readable, so all these large data objects will be much easier to understand than if defined in Ruby.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@akofink
Copy link
Contributor

akofink commented Nov 17, 2014

Please merge the current rails4 branch.

@akofink akofink added the Merge label Nov 18, 2014
@akofink akofink merged commit fb22796 into expertiza:rails4 Dec 11, 2014
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling fb22796 on noelmathew:rails4 into * on expertiza:rails4*.

@Winbobob Winbobob added this to the CSC517 2014 Fall OSS Projects milestone Oct 3, 2016
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.

7 participants