Coursemology/coursemology.org — pull request #17 by exklamationmark (2013-08-17 05:34:38+00:00)
Title: Mark/rearrangeable questions

https://trello.com/c/bX4uKcsx/32-question-order-and-reorder-drag-drop

- In `training#show's view`, turn the tbody of the questions table into a ordered list, sorted by the questions's asm-qn's `pos` attribute
- Add routes & controller to handle changing `pos` attribute of asm-qns
- Make AJAX call when the questions table is reordered, updating the asm-qns's `pos` attribute
- Styling to make the questions's title looks like it's draggable

I made one assumption:
### each CodingQuestion or Mcq only have 1 asm_qn
in the model, it was a has_many relation, but when I tried to create a MCQ, there is only 1 asm_qn per question. Thus leads me to this belief.

Why I need that:
1. Only asm_qn has a `pos` attribute that I can use to save the order of the question. CodingQuestion and Mcq don't have that.
2. In order to update the asm_qn's `pos`, I need to get its id
3. In the view, when showing the CodingQuestion / Mcq, I need to give each of the question row an id so (the asm_qn's id). So I get the id of the first asm_qn of that CodingQuestion / Mcq

This assumption might be wrong. If so, can you give me an example in Coursemology where CodingQuestion / Mcq has multiple asm_qns? I can change my code then