Skip to content

Commit

Permalink
Remove the compatibility with old data structure / only save goal for…
Browse files Browse the repository at this point in the history
… current team in interation (#13)
  • Loading branch information
keesschollaart81 committed Oct 13, 2018
1 parent ffdce5d commit de57cd4
Showing 1 changed file with 1 addition and 41 deletions.
42 changes: 1 addition & 41 deletions src/sprint-goal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,6 @@ export class SprintGoal {
if (goal) {
sprintGoalInTabLabel = (this.getCookie(this.getConfigKey(this.iterationId, this.teamId) + "sprintGoalInTabLabel") == "true");

} else {
var goal = this.getCookie(this.iterationId + this.teamId + "goalText");
if (goal) {
sprintGoalInTabLabel = (this.getCookie(this.iterationId + this.teamId + "sprintGoalInTabLabel") == "true");
}
else {
goal = this.getCookie(this.iterationId + "goalText");
sprintGoalInTabLabel = (this.getCookie(this.iterationId + "sprintGoalInTabLabel") == "true");
}
}

if (!goal) return undefined;
Expand All @@ -173,19 +164,14 @@ export class SprintGoal {

if (this.ai) this.ai.trackEvent("SaveSettings", sprintConfig);

var configIdentifier: string = this.iterationId.toString();
var configIdentifierWithTeam: string = this.getConfigKey(this.iterationId, this.teamId);

this.updateSprintGoalCookie(configIdentifier, sprintConfig);
this.updateSprintGoalCookie(configIdentifierWithTeam, sprintConfig);

return VSS.getService(VSS.ServiceIds.ExtensionData)
.then((dataService: Extension_Data.ExtensionDataService) => {
this.log('saveSettings: ExtensionData Service Loaded, saving for ' + configIdentifierWithTeam, sprintConfig);
return dataService.setValue("sprintConfig." + configIdentifierWithTeam, sprintConfig).then((x) => {
// override the project level goal, indeed: last team saving 'wins'
return dataService.setValue("sprintConfig." + configIdentifier, sprintConfig);
});
return dataService.setValue("sprintConfig." + configIdentifierWithTeam, sprintConfig);
})
.then((value: object) => {
this.log('saveSettings: settings saved!', value);
Expand All @@ -201,43 +187,17 @@ export class SprintGoal {
var cookieSupport = this.checkCookie();

if (forceReload || !currentGoalInCookie || !cookieSupport) {
var configIdentifier = this.iterationId.toString();
var oldConfigIdentifierWithTeam = this.iterationId.toString() + this.teamId;
var configIdentifierWithTeam = this.getConfigKey(this.iterationId, this.teamId);

return this.fetchSettingsFromExtensionDataService(configIdentifierWithTeam).then((teamGoal: SprintGoalDto): IPromise<SprintGoalDto> => {
if (teamGoal) {
this.updateSprintGoalCookie(configIdentifier, teamGoal);
this.updateSprintGoalCookie(configIdentifierWithTeam, teamGoal);

return Q.fcall((): SprintGoalDto => {
// team settings
return teamGoal;
});
}
else {
return this.fetchSettingsFromExtensionDataService(oldConfigIdentifierWithTeam).then((oldTeamGoal) => {
if (oldTeamGoal) {
this.updateSprintGoalCookie(configIdentifier, oldTeamGoal);
this.updateSprintGoalCookie(configIdentifierWithTeam, oldTeamGoal);
return oldTeamGoal;
}
else return null;
}).then((goal) => {
if (goal) {
return Q.fcall((): SprintGoalDto => {
return goal;
});
}
return this.fetchSettingsFromExtensionDataService(configIdentifier).then((iterationGoal) => {
if (iterationGoal) {
this.updateSprintGoalCookie(configIdentifier, iterationGoal);
}
return iterationGoal;
})
});

}
});
}
else {
Expand Down

0 comments on commit de57cd4

Please sign in to comment.