This should be something simple but I’ve been at it for a day now and can’t see a clear answer.
I have three basic models: User, Evaluation and Job. Users work on the job and the job owner evaluates the users. A user can have many various jobs. Each job will evaluate its related users multiple times (within the job, each related user will have the same evaluations – with different scores, of course.)
So, simply, I would like to present the data in tabular form (kind of like an excel workbook) with the evaluation name going across the x axis and the user names going down the y axis.
So, it would look like this:
Evaluation 1 | Evaluation 2 | Evaluation 3
_______________________________________________________
User 1 Good Poor Outstanding
User 2 Poor Good Good
I can easily show the labels across either the x OR the y but not both.
Q1) Each Job/User Evaluation is its own db record. Any suggestions as to how I would structure the the LABELS across the x and y axis?
Q2) How would I ensure the data (for example, User 2 Evaluation 3) is categorized (plotted) correctly? And, what if a new User (e.g., User 3) joins the job late and doesn’t have Evaluation 1 or Evaluation 2…
Any and all suggestions are welcome!
One way of doing it is to create an array of hashes, each hash containing user rating and an array of all available evaluations, something like
This will give you something similar to all_evaluations:
User evaluations hash would look something like this:
all_evaluationswill be used for header row labels and for pulling evals for each user records:There might be few bugs/changes here, but it should work in principal.