Closed btmatthew closed 7 years ago
MBTI:
Hard coded: https://github.com/criscmaia/gsdforms/blob/master/mbti.php#L510
{ "keys" : ["p", "a", "e","i"], "1" : [["p"],["a"]], "2" : [["e"],["i"]], "3" : [["e"],["p"]], "4" : [["a"],["i"]], "5" : [["i"],["p"]], "6" : [["a"],["e"]], "7" : [["p","a"],["p","e"]], "8" : [["a","i"],["e","i"]], "9" : [["p","a"],["p","i"]], "10" : [["a","e"],["e","i"]], "11" : [["p","a"],["a","i"]], "12" : [["a","e"],["p","a"]], "13" : [["a","e"],["a","i"]], "14" : [["e","i"],["p","i"]], "15" : [["p","a"],["e","i"]], "16" : [["a","i"],["p","i"]], "17" : [["p","e"],["p","i"]], "18" : [["p","e","i"],["a"]], "19" : [["p","e"],["a","e"]], "20" : [["e","i"],["p","e"]], "21" : [["p","e"],["a","i"]], "22" : [["p","a","e"],["p","a","i"]], "23" : [["p","e","i"],["a","e","i"]], "24" : [["p","a","e"],["p","e","i"]], "25" : [["p","a","i"],["a","e","i"]], "26" : [["p","a","e"],["a","e","i"]], "27" : [["p","a","i"],["p","e","i"]], }
fun mbtiResult() :HashMap<String,Int>{
val answerTally = HashMap<String, Int>()
answerTally["e"] = 0
answerTally["i"] = 0
answerTally["s"] = 0
answerTally["n"] = 0
answerTally["t"] = 0
answerTally["f"] = 0
answerTally["j"] = 0
answerTally["p"] = 0
for (k in 1..answers.size) {
for (l in 1..7) {
val sub = k - l
if (sub % 7 == 0) {
var value : Int
when (l) {
1 -> if (answers[k]==1){
value = answerTally["e"]!!+1
answerTally.put("e",value)
} else{
value = answerTally["i"]!!+1
answerTally.put("i",value)
}
2 -> if (answers[k]==1){
value = answerTally["s"]!!+1
answerTally.put("s",value)
} else{
value = answerTally["n"]!!+1
answerTally.put("n",value)
}
3 -> if (answers[k]==1){
value = answerTally["s"]!!+1
answerTally.put("s",value)
} else{
value = answerTally["n"]!!+1
answerTally.put("n",value)
}
4 -> if (answers[k]==1){
value = answerTally["t"]!!+1
answerTally.put("t",value)
} else{
value = answerTally["f"]!!+1
answerTally.put("f",value)
}
5 -> if (answers[k]==1){
value = answerTally["t"]!!+1
answerTally.put("t",value)
} else{
value = answerTally["f"]!!+1
answerTally.put("f",value)
}
6 -> if (answers[k]==1){
value = answerTally["j"]!!+1
answerTally.put("j",value)
} else{
value = answerTally["p"]!!+1
answerTally.put("p",value)
}
7 -> if (answers[k]==1){
value = answerTally["j"]!!+1
answerTally.put("j",value)
} else{
value = answerTally["p"]!!+1
answerTally.put("p",value)
}
}
}
}
}
return answerTally
}
Implemented, please test and close this once if successful.
MBTI results when
All answers are 1: E:10 I:0 S:20 N:0 T:20 F:0 J:20 P:0
All answers are 2: E:0 I:10 S:0 N:20 T:0 F:20 J:0 P:20
question 0, answer 1, value j, tally 1 question 1, answer 1, value e, tally 1 question 2, answer 1, value s, tally 1 question 3, answer 1, value s, tally 2 question 4, answer 1, value t, tally 1 question 5, answer 1, value t, tally 2 question 6, answer 1, value j, tally 2 question 7, answer 1, value j, tally 3 question 8, answer 1, value e, tally 2 question 9, answer 1, value s, tally 3 question 10, answer 1, value s, tally 4 question 11, answer 1, value t, tally 3 question 12, answer 1, value t, tally 4 question 13, answer 1, value j, tally 4 question 14, answer 1, value j, tally 5 question 15, answer 1, value e, tally 3 question 16, answer 1, value s, tally 5 question 17, answer 1, value s, tally 6 question 18, answer 1, value t, tally 5 question 19, answer 1, value t, tally 6 question 20, answer 1, value j, tally 6 question 21, answer 1, value j, tally 7 question 22, answer 1, value e, tally 4 question 23, answer 1, value s, tally 7 question 24, answer 1, value s, tally 8 question 25, answer 1, value t, tally 7 question 26, answer 1, value t, tally 8 question 27, answer 1, value j, tally 8 question 28, answer 1, value j, tally 9 question 29, answer 1, value e, tally 5 question 30, answer 1, value s, tally 9 question 31, answer 1, value s, tally 10 question 32, answer 1, value t, tally 9 question 33, answer 1, value t, tally 10 question 34, answer 1, value j, tally 10 question 35, answer 1, value j, tally 11 question 36, answer 1, value e, tally 6 question 37, answer 1, value s, tally 11 question 38, answer 1, value s, tally 12 question 39, answer 1, value t, tally 11 question 40, answer 1, value t, tally 12 question 41, answer 1, value j, tally 12 question 42, answer 1, value j, tally 13 question 43, answer 1, value e, tally 7 question 44, answer 1, value s, tally 13 question 45, answer 1, value s, tally 14 question 46, answer 1, value t, tally 13 question 47, answer 1, value t, tally 14 question 48, answer 1, value j, tally 14 question 49, answer 1, value j, tally 15 question 50, answer 1, value e, tally 8 question 51, answer 1, value s, tally 15 question 52, answer 1, value s, tally 16 question 53, answer 1, value t, tally 15 question 54, answer 1, value t, tally 16 question 55, answer 1, value j, tally 16 question 56, answer 1, value j, tally 17 question 57, answer 1, value e, tally 9 question 58, answer 1, value s, tally 17 question 59, answer 1, value s, tally 18 question 60, answer 1, value t, tally 17 question 61, answer 1, value t, tally 18 question 62, answer 1, value j, tally 18 question 63, answer 1, value j, tally 19 question 64, answer 1, value e, tally 10 question 65, answer 1, value s, tally 19 question 66, answer 1, value s, tally 20 question 67, answer 1, value t, tally 19 question 68, answer 1, value t, tally 20 question 69, answer 1, value j, tally 20
PAEI results when
All answers are 1: P: 15 A: 16 E: 15 I: 9
All answers are 2: P: 12 A: 11 E: 12 I: 18
MBTI working, PAEI not working, I think the JSON file is the problem, could you please double check it for me?
{ "keys" : ["p", "a", "e","i"], "1" : [["p"],["a"]], "2" : [["e"],["i"]], "3" : [["e"],["p"]], "4" : [["a"],["i"]], "5" : [["i"],["p"]], "6" : [["a"],["e"]], "7" : [["p","a"],["p","e"]], "8" : [["a","i"],["e","i"]], "9" : [["p","a"],["p","i"]], "10" : [["a","e"],["e","i"]], "11" : [["p","a"],["a","i"]], "12" : [["a","e"],["p","a"]], "13" : [["a","e"],["a","i"]], "14" : [["e","i"],["p","i"]], "15" : [["p","a"],["e","i"]], "16" : [["a","i"],["p","i"]], "17" : [["p","e"],["p","i"]], "18" : [["p","e","i"],["a"]], "19" : [["p","e"],["a","e"]], "20" : [["e","i"],["p","e"]], "21" : [["p","e"],["a","i"]], "22" : [["p","a","e"],["p","a","i"]], "23" : [["p","e","i"],["a","e","i"]], "24" : [["p","a","e"],["p","e","i"]], "25" : [["p","a","i"],["a","e","i"]], "26" : [["p","a","e"],["a","e","i"]], "27" : [["p","a","i"],["p","e","i"]] }
PAEI correct according to source below:
MBTI and PAEI results being saved correctly on the DB.
I have converted the PAEI survey answers results to JSON format.
Could you please double check that no mistakes were made during the process?
Could you also convert the MBTI answers into the same format, please? { "keys" : ["p", "a", "e","i"], "1" : [["p"],["a"]], "2" : [["e"],["i"]], "3" : [["e"],["p"]], "4" : [["a"],["i"]], "5" : [["i"],["e"]], "6" : [["a"],["e"]], "7" : [["p","a"],["p","e"]], "8" : [["a","i"],["e","i"]], "9" : [["p","a"],["p","i"]], "10" : [["a","e"],["e","i"]], "11" : [["p","a"],["a","e"]], "12" : [["a","e"],["p","a"]], "13" : [["a","e"],["p","a"]], "14" : [["e","i"],["p","i"]], "15" : [["p","a"],["e","i"]], "16" : [["a","i"],["p","i"]], "17" : [["p","e"],["p","i"]], "18" : [["p","e","i"],["a"]], "19" : [["p","e"],["a","e"]], "20" : [["e","i"],["p","e"]], "21" : [["p","e"],["a","i"]], "22" : [["p","a","e"],["p","a","i"]], "23" : [["p","e","i"],["a","e","i"]], "24" : [["p","a","e"],["p","e","i"]], "25" : [["p","a","i"],["a","e","i"]], "26" : [["p","a","e"],["a","e","i"]], "27" : [["p","a","i"],["p","e","i"]], }