Note that there are some explanatory texts on larger screens.

plurals
  1. POCreating DB views in Ruby on Rails
    primarykey
    data
    text
    <p>I'm adding reporting functionality to a project.</p> <p>3 roles here:</p> <p>1) Volunteers (they report what hours they volunteered)</p> <p>2) Supervisors (they look at the reported stuff, note: one supervisor can view all projects)</p> <p>3) Projects (Represents a work project that some collection of volunteers work on)</p> <p>To explain what it does:</p> <p>A report will be specified by the supervisor to generate based on a query of what he needs.</p> <p>These could be plausible reports:</p> <p>1) The total number of volunteers, and the total amount of volunteer hours on this project</p> <p>2) All the volunteer's names and emails associated with a project</p> <p>3) The number of active projects vs. the total number of projects</p> <p>I was thinking maybe that creating a database view in Rails and storing the name of that view so Rails will just check the view whenever a supervisor wants to pull up the report.</p> <p>Is a view really the answer or is it better to just save a query?</p> <p>Can Rails do this or is there an even better or more simple way of achieving this functionality?</p> <p>Edit: A report is essentially a sql query in the back. We want supervisors to be able to create their own reports as well. We intend to build some front end UI to make it easier. </p> <p>I just thought that having a table storing the views would be more descript (ReportID, ViewName) than a table storing the SQL query (ReportID, SQLQuery). Also I was thinking of saving space very specialized SQL queries get very large and confusing. I apologize for being confusing since I am really new to Ruby and Rails</p> <p>For example: I was thinking what could be powering the #2 report would be this query (or equivalent code for view: select v.volunteerName, v.volunteerEmail from volunteers v,volunteering vg where v.volunteerId = vg.volunteerId AND vg.projectId = (Some Arguement passed by user)</p> <p>Note that the volunteering database is a relationship database as a volunteer can volunteer for more than one project.</p> <p>Cheers, -Jeremiah Tantongco</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload