Skip to content

Question merging details (WIP)

Haris Ibrahim K. V edited this page Dec 15, 2015 · 11 revisions

Process

  • A question has a set of answers
  • A question belongs to one or more questiongroups (QG) via a M2M relation through QuestionGroupQuestion (QGQ).
  • The important part in the relation is the sequence number that particular Question has.
  • Assume there are two questions - Question duplicate and Question original.
  • Duplicate has a set of answers and it belongs to a QuestionGroup, say latte.
  • Steps to be followed to merge duplicate with original:
1.  q1 = <Question: Was the school open? - radio> # To be deleted. This is the duplicate.
2.  q2 = <Question: Was the school open? - checkbox> # This is the original.
3.  qgq = q1.questiongroupquestions_set.get()
4.  qgq.question = q2
5.  qgq.save()
6.  a = q1.answer_set.all()
7.  for i in a:
        i.question = q2
        i.save()

Current state of affairs

Question 1:

  • Permanent: "Was the school open?"

  • To be merged: "Was the school open?"

  • On Dev and Production:

Belonged to:-

  • QG: Questiongroup: web v2
  • Type: Question: Was the school open? - radio
  • id: 141 (Not deleted)
  • QG: Questiongroup: ivrs v1
  • Type: Question: Was the school open? - checkbox
  • id: 99 (Not deleted)
  • QG: Questiongroup: ivrs v2, Questiongroup: ivrs v3, Questiongroup: ivrs v4
  • Type: Question: Was the school open? - checkbox
  • id: 129

Now belongs to:-

  • QG: Questiongroup: ivrs v2, Questiongroup: ivrs v3, Questiongroup: ivrs v4, Questiongroup: ivrs v1, Questiongroup: web v2
  • Type: Question: Was the school open? - checkbox
  • id: 129

Question 2:

  • Permanent: "Were the toilets for children in good condition?"

  • To be merged: "Are all the toilets in the school functional?"

  • On Dev:

Belonged to:-

  • QG: Questiongroup: web v2
  • Type: Question: Are all the toilets in the school functional? - radio
  • id: 142 (Not deleted)
  • QG: Questiongroup: ivrs v2, Questiongroup: community v4, Questiongroup: ivrs v3, Questiongroup: ivrs v4
  • Type: Are all the toilets in the school functional? - checkbox
  • id: 137 (Not deleted)
  • QG: Questiongroup: ivrs v1
  • Type: Were the toilets for children in good condition? - checkbox
  • id: 102

Now belongs to:-

  • QG: Questiongroup: web v2 (Need to understand if the sys form is dependant upon the question text before we merge this)
  • Type: Question: Are all the toilets in the school functional? - radio
  • id: 142 (Not deleted)
  • QG: Questiongroup: ivrs v4, Questiongroup: ivrs v3, Questiongroup: community v4, Questiongroup: ivrs v2, Questiongroup: ivrs v1
  • Type: Were the toilets for children in good condition? - checkbox
  • id: 102