Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Find Personas from survey replies
function testPersonas() {
var personas = AssignPersonas(
"Get inspired about new activities and formats I can run with my community",
"Building connections and celebrate with the other GDG leads at the summit and I/O",
"I've been around for a while (3+ years)",
"0",
"500 - 1000");
Logger.log(personas);
}
/**
Params
*/
function AssignPersonas(firstReason, secondReason, experience, summitsAttended, communityMembers) {
var rookie = 0;
var professor = 1;
var hunter = 2;
var casual = 3;
var scores = new Array(4);
for (i=0; i<scores.length; i++) {
scores[i] = 0;
}
switch (firstReason) {
case "Share and discuss my GDG lead experience with other community leaders":
add_(scores, professor, 10);
add_(scores, hunter, 10);
break;
case "Learn how to be a great community leader":
add_(scores, rookie, 10);
break;
case "Get inspired about new activities and formats I can run with my community":
add_(scores, rookie, 10);
add_(scores, hunter, 10);
break;
case "Building connections and celebrate with the other GDG leads at the summit":
add_(scores, professor, 10);
add_(scores, casual, 10);
break;
case "All of the above":
add_(scores, rookie, 5);
add_(scores, professor, 5);
add_(scores, hunter, 5);
add_(scores, casual, 5);
break;
}
switch (secondReason) {
case "Share and discuss my GDG lead experience with other community leaders":
add_(scores, professor, 10);
add_(scores, hunter, 10);
break;
case "Learn how to be a great community leader":
add_(scores, rookie, 10);
break;
case "Get inspired about new activities and formats I can run with my community":
add_(scores, rookie, 10);
add_(scores, hunter, 10);
break;
case "Building connections and celebrate with the other GDG leads at the summit":
add_(scores, professor, 10);
add_(scores, casual, 10);
break;
}
switch (experience) {
case "Just started (less than 1 year)":
add_(scores, rookie, 20);
add_(scores, hunter, 5);
add_(scores, casual, 5);
break;
case "I'm somewhat experienced (1-2 years)":
add_(scores, rookie, 10);
add_(scores, professor, 10);
add_(scores, hunter, 10);
add_(scores, casual, 15);
break;
case "I've been around for a while (3+ years)":
add_(scores, professor, 20);
add_(scores, hunter, 10);
add_(scores, casual, 10);
break;
}
switch (summitsAttended) {
case "0" || 0:
add_(scores, rookie, 5);
add_(scores, hunter, 2);
break;
case "1" || 1:
add_(scores, rookie, 5);
add_(scores, hunter, 3);
add_(scores, casual, 5);
break;
case "2" || 2:
add_(scores, professor, 2);
add_(scores, hunter, 5);
add_(scores, casual, 5);
break;
case "3-4":
add_(scores, professor, 3);
break;
case "5 or more":
add_(scores, professor, 5);
break;
}
switch (communityMembers) {
case "<200":
add_(scores, rookie, 10);
add_(scores, hunter, 5);
add_(scores, casual, 5);
break;
case "200 - 500":
add_(scores, rookie, 10);
add_(scores, professor, 5);
add_(scores, hunter, 5);
add_(scores, casual, 10);
break;
case "500 - 1000":
add_(scores, rookie, 5);
add_(scores, professor, 10);
add_(scores, hunter, 10);
add_(scores, casual, 5);
break;
case "1000+":
add_(scores, professor, 10);
add_(scores, hunter, 5);
add_(scores, casual, 5);
break;
}
// Calculate max scored personas
var maxScoreIndex = 0
var maxScore = 0;
for (i=0; i<scores.length; i++) {
if (scores[i] > maxScore) {
maxScore = scores[i];
maxScoreIndex = i;
}
}
var personas = "Unknown";
switch(maxScoreIndex) {
case rookie: personas = "Rookie"; break;
case professor: personas = "Professor"; break;
case hunter: personas = "Hunter"; break;
case casual: personas = "Casual"; break;
}
return personas + " (" + scores[maxScoreIndex] + ")";
}
function add_(scores, index, score) {
scores[index] += score;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.