Skip to content

Commit dbf1440

Browse files
committed
goDeveloperSurvey: update link and start/end date
Tested manually by updating the probabilities and timeouts, and it seems to work as expected. Change-Id: If980a1cf69eb3cecfe25f00897eeb907430924e1 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/356929 Trust: Rebecca Stambler <[email protected]> Trust: Hyang-Ah Hana Kim <[email protected]> Run-TryBot: Rebecca Stambler <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]> Reviewed-by: Hyang-Ah Hana Kim <[email protected]> TryBot-Result: kokoro <[email protected]>
1 parent 9a0cabf commit dbf1440

File tree

2 files changed

+21
-24
lines changed

2 files changed

+21
-24
lines changed

src/goDeveloperSurvey.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import { lastUserAction } from './goLanguageServer';
1212
import { daysBetween, flushSurveyConfig, getStateConfig, minutesBetween, timeMinute } from './goSurvey';
1313

1414
// Start and end dates of the survey.
15-
export const startDate = new Date('2021-09-01'); // TODO(rstambler): Set an actual start date.
16-
export const endDate = new Date('2022-01-01'); // TODO(rstambler): Set an actual end date.
15+
export const startDate = new Date('2021-10-27');
16+
export const endDate = new Date('2021-11-16');
1717

1818
// DeveloperSurveyConfig is the set of global properties used to determine if
1919
// we should prompt a user to take the gopls survey.
@@ -81,11 +81,14 @@ export function shouldPromptForSurvey(now: Date, cfg: DeveloperSurveyConfig): De
8181
if (cfg.datePromptComputed && !inDateRange(startDate, endDate, cfg.datePromptComputed)) {
8282
cfg = {};
8383
}
84-
// If the prompt value is not set, assume we haven't prompted the user
85-
// and should do so.
84+
// If the prompt value is undefined, then this is the first activation
85+
// for this survey period, so decide if we should prompt the user. This
86+
// is done by generating a random number in the range [0, 1) and checking
87+
// if it is < probability.
8688
if (cfg.prompt === undefined) {
87-
cfg.prompt = true;
89+
const probability = 0.2;
8890
cfg.datePromptComputed = now;
91+
cfg.prompt = Math.random() < probability;
8992
}
9093
flushSurveyConfig(developerSurveyConfig, cfg);
9194
if (!cfg.prompt) {
@@ -103,29 +106,26 @@ export function shouldPromptForSurvey(now: Date, cfg: DeveloperSurveyConfig): De
103106
// Check if the user has been prompted for the survey in the last 5 days.
104107
// Don't prompt them if they have been.
105108
if (cfg.lastDatePrompted) {
106-
// If the survey will end in 5 days, prompt the next day.
109+
const daysSinceLastPrompt = daysBetween(now, cfg.lastDatePrompted);
110+
// Don't prompt twice on the same day, even if it's the last day of the
111+
// survey.
112+
if (daysSinceLastPrompt < 1) {
113+
return;
114+
}
115+
// If the survey will end in 5 days, prompt on the next day.
107116
// Otherwise, wait for 5 days.
108-
if (daysBetween(now, endDate) > 5 && daysBetween(now, cfg.lastDatePrompted) < 5) {
117+
if (daysBetween(now, endDate) > 5) {
109118
return;
110119
}
111-
return cfg;
112120
}
113-
114-
// This is the first activation this month (or ever), so decide if we
115-
// should prompt the user. This is done by generating a random number in
116-
// the range [0, 1) and checking if it is < probability.
117-
const probability = 0.2;
118-
cfg.datePromptComputed = now;
119-
cfg.prompt = Math.random() < probability;
120-
flushSurveyConfig(developerSurveyConfig, cfg);
121121
return cfg;
122122
}
123123

124124
export async function promptForDeveloperSurvey(cfg: DeveloperSurveyConfig, now: Date): Promise<DeveloperSurveyConfig> {
125125
let selected = await vscode.window.showInformationMessage(
126126
// TODO(rstambler): Figure out how to phrase this.
127-
`Looks like you are coding in Go! Help ensure Go is meeting your needs
128-
by participating in this 10-minute survey by ${endDate.toDateString()}?`,
127+
`Looks like you are coding in Go! Would you like to help ensure that Go is meeting your needs
128+
by participating in this 10-minute survey before ${endDate.toDateString()}?`,
129129
'Yes',
130130
'Remind me later',
131131
'Never'
@@ -140,7 +140,7 @@ by participating in this 10-minute survey by ${endDate.toDateString()}?`,
140140
{
141141
cfg.lastDateAccepted = now;
142142
cfg.prompt = true;
143-
const surveyURL = 'https://google.com?utm_source=vscode-go'; // set source to vscode-go
143+
const surveyURL = 'https://google.qualtrics.com/jfe/form/SV_0BwHwKSaeE9Cx2S?s=p';
144144
await vscode.env.openExternal(vscode.Uri.parse(surveyURL));
145145
}
146146
break;
@@ -154,7 +154,7 @@ by participating in this 10-minute survey by ${endDate.toDateString()}?`,
154154

155155
selected = await vscode.window.showInformationMessage(
156156
`No problem! We won't ask again.
157-
To opt-out of all survey prompts, please set 'go.survey.prompt' to false.`,
157+
If you'd like to opt-out of all survey prompts, you can set 'go.survey.prompt' to false.`,
158158
'Open Settings'
159159
);
160160
switch (selected) {

src/goLanguageServer.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,7 @@ function scheduleGoplsSuggestions() {
279279
return;
280280
}
281281
maybePromptForGoplsSurvey();
282-
// TODO(rstambler): Remove this when the survey is published.
283-
if (isInPreviewMode()) {
284-
maybePromptForDeveloperSurvey();
285-
}
282+
maybePromptForDeveloperSurvey();
286283
};
287284
setTimeout(update, 10 * timeMinute);
288285
setTimeout(survey, 30 * timeMinute);

0 commit comments

Comments
 (0)