On Mon, Nov 14, 2011 at 00:26, Pragma O. [email protected] wrote:
I am making a web application that basically allows user to create a
table. They name the table and add columns (field). Then they add
entries (rows), just like a typical table.
…
How would I model this with a ruby class?
I don’t think you could easily do it with a single class, but I just
put a Rails app up on Heroku to do something spreadsheet-like, and you
might find my models adaptable. (The UI is unpolished, there isn’t
much description or help, and the workflow needs some tweaking, but
basic functionality is ready.) Check out:
http://thedecider.herokuapp.com
The models are:
- Decisions have a name and a User, and many Factors and Alternatives
- Factors have a name, and a numeric weight, and belong to a Decision
- Alternatives have a name, and belong to a Decision
- Rankings have a Factor, an Alternative, and a numeric level
The purpose is to multiply the levels by the weights and thus decide
on what’s the best Alternative.
Similarly, a couple years back I wrote a RoR app for work, in which,
IIRC:
- A Sheet had a name, and many Projects and Parts through Ratings
- A Project had a name, and belonged to many Sheets through Ratings
- A Part had a name (meant to be some standard aspect of a project),
and belonged to many Sheets through Ratings
- A Facet had a name, intended to be something like Benefit, Effort, or
Risk
- A Rating had a Project, a Part, a Facet, and a Level. The Project
and Part could be nil to indicate an overall rating for the other
item.
- Sheets were displayed with a dropdown list of Facets, including some
pseudo-facets like “Benefit / Risk”, “Benefit / Effort”, and “Benefit
/ Risk / Effort”. If pseudo-facets were displayed, the sheet was
read-only.
The purpose was to let a manager extrapolate and interpolate from
partial decisions about the levels of benefit, risk, or other facets,
of certain projects and their parts, to the whole project, or that
part in general so as to be able to rate other projects, and their
parts. Then he could also divide one sheet by another (or in the case
of B/R/E, two) to find the “low hanging fruit”. I’ve been intending
to reconstruct this thing, with separate user accounts and
authentication, and push it to Heroku. (Max, if you’ve ever heard the
Tools guys mention BEARPISS, that was this.)
If I wanted to make a generic spreadsheet, just for storage, no
calculation, I think I’d do:
- Sheets have a name, and many Rows and Columns
- Rows and Columns have names, and belong to a Sheet
- Cells have a Row and a Column
Then instead of having each cell-change cause a submission as
TheDecider currently does, have a master Submit button. (I’m thinking
of switching to that since the Alternatives get sorted by total score
so the movement gets confusing.)
-Dave
–
LOOKING FOR WORK! What: Ruby (on/off Rails), Python, other modern
languages.
Where: Northern Virginia, Washington DC (near Orange Line), and remote
work.
See: davearonson.com (main) * codosaur.us (code) * dare2xl.com
(excellence).
Specialization is for insects. (Heinlein) - Have Pun, Will Babble!
(Aronson)