Baseball player statistics controller
up vote
7
down vote
favorite
I'm somewhat new to JavaScript and AngularJS, and read in Doug Crockford's book that the hoisting function declaration can lead to issues. Any pointers on how to structure my file would be much appreciated.
(function() {
'use strict';
function PlayerProfileStatsCtrl($q, ColumnService, LookupService, PlayerService, PlayerStatsService) {
var vm = this;
var loadStats = function (player) {
$q.all({
catchingStats: PlayerStatsService.getCatchingStats(player.playerId),
fieldingStats: PlayerStatsService.getFieldingStats(player.playerId),
hittingStats: PlayerStatsService.getHittingStats(player.playerId),
pitchingStats: PlayerStatsService.getPitchingStats(player.playerId),
playerStats: LookupService.getByKeyPromise('lkplayerstat'),
statTypes: LookupService.getListPromise('lkstattype')
}).then(function (results) {
// Associate stat result lists with string keyed stat types.
vm.statResults = {
C: results.catchingStats.statList,
F: results.fieldingStats.statList,
H: results.hittingStats.statList,
P: results.pitchingStats.statList
};
// Assign the player stat lookup object.
vm.playerStats = results.playerStats;
// Assign the stat type lookup list.
vm.statTypes = results.statTypes;
initStatColumnDefs();
});
};
// Call loadStats() after the player promise is resolved.
vm.player = PlayerService.getPlayer(loadStats);
var initStatColumnDefs = function () {
// The column definitions are contained in lists and associated by stat type.
vm.statColumnDefs = {};
for (var i = 0; i < vm.statTypes.length; i++) {
// Get the current stat type key: { 'C', 'F', 'H', 'P' }
var statTypeKey = vm.statTypes[i].statTypeLk;
// Get the list of column names from the user.
var userSelectedStats = ColumnService.getColumns('STATS_' + statTypeKey);
var getStatColumnDefs = function (userColumns) {
var columnDefs = ;
// Each stat section will start with these columns.
columnDefs.push({ name: 'Season', fullName: 'Season', property: 'statDb.year' });
columnDefs.push({ name: 'Team', fullName: 'Team', property: 'team.teamName' });
columnDefs.push({ name: 'Level', fullName: 'Level', property: 'level.shortDescription' });
// Fielding has an additional column in before custom columns are displayed.
if (statTypeKey === 'F') {
columnDefs.push({ name: 'Pos', fullName: 'Position', property: 'statDb.positionLk' });
}
// Construct a custom stat column definition.
var getCustomColumnDef = function (userColumn) {
var currentStat = vm.playerStats[userColumn];
var displayName = currentStat.shortDescription;
var onHoverName = currentStat.description;
var statProperty = 'statDb.' + currentStat.statProperty;
// Format the custom stat according to the player stat lookup table.
var getFormattedStat = function (val) {
if (val === undefined) { // Return null if there is no value for that stat.
return;
} else {
if (!isNaN(val)) { // Only process numbers.
val = String(val.toFixed(currentStat.precision));
// Remove leading zero.
if (currentStat.leadingZeroFlg && val.startsWith('0')) {
val = val.substr(1, val.length-1);
}
// Add a % sign to the end of the stat.
if (currentStat.percentFlg) {
val += '%';
}
}
return val;
}
}
return { name: displayName, fullName: onHoverName, property: statProperty, format: getFormattedStat };
}
// Add a definition for each of the custom columns.
for (var i = 0; i < userColumns.length; i++) {
columnDefs.push(getCustomColumnDef(userColumns[i]));
}
return columnDefs;
}
// Store the list of defintions by stat type.
vm.statColumnDefs[statTypeKey] = getStatColumnDefs(userSelectedStats);
}
}
}
angular
.module('players')
.controller('PlayerProfileStatsCtrl', [ '$q', 'ColumnService', 'LookupService', 'PlayerService', 'PlayerStatsService', PlayerProfileStatsCtrl ])
})();
javascript angular.js statistics promise controller
add a comment |
up vote
7
down vote
favorite
I'm somewhat new to JavaScript and AngularJS, and read in Doug Crockford's book that the hoisting function declaration can lead to issues. Any pointers on how to structure my file would be much appreciated.
(function() {
'use strict';
function PlayerProfileStatsCtrl($q, ColumnService, LookupService, PlayerService, PlayerStatsService) {
var vm = this;
var loadStats = function (player) {
$q.all({
catchingStats: PlayerStatsService.getCatchingStats(player.playerId),
fieldingStats: PlayerStatsService.getFieldingStats(player.playerId),
hittingStats: PlayerStatsService.getHittingStats(player.playerId),
pitchingStats: PlayerStatsService.getPitchingStats(player.playerId),
playerStats: LookupService.getByKeyPromise('lkplayerstat'),
statTypes: LookupService.getListPromise('lkstattype')
}).then(function (results) {
// Associate stat result lists with string keyed stat types.
vm.statResults = {
C: results.catchingStats.statList,
F: results.fieldingStats.statList,
H: results.hittingStats.statList,
P: results.pitchingStats.statList
};
// Assign the player stat lookup object.
vm.playerStats = results.playerStats;
// Assign the stat type lookup list.
vm.statTypes = results.statTypes;
initStatColumnDefs();
});
};
// Call loadStats() after the player promise is resolved.
vm.player = PlayerService.getPlayer(loadStats);
var initStatColumnDefs = function () {
// The column definitions are contained in lists and associated by stat type.
vm.statColumnDefs = {};
for (var i = 0; i < vm.statTypes.length; i++) {
// Get the current stat type key: { 'C', 'F', 'H', 'P' }
var statTypeKey = vm.statTypes[i].statTypeLk;
// Get the list of column names from the user.
var userSelectedStats = ColumnService.getColumns('STATS_' + statTypeKey);
var getStatColumnDefs = function (userColumns) {
var columnDefs = ;
// Each stat section will start with these columns.
columnDefs.push({ name: 'Season', fullName: 'Season', property: 'statDb.year' });
columnDefs.push({ name: 'Team', fullName: 'Team', property: 'team.teamName' });
columnDefs.push({ name: 'Level', fullName: 'Level', property: 'level.shortDescription' });
// Fielding has an additional column in before custom columns are displayed.
if (statTypeKey === 'F') {
columnDefs.push({ name: 'Pos', fullName: 'Position', property: 'statDb.positionLk' });
}
// Construct a custom stat column definition.
var getCustomColumnDef = function (userColumn) {
var currentStat = vm.playerStats[userColumn];
var displayName = currentStat.shortDescription;
var onHoverName = currentStat.description;
var statProperty = 'statDb.' + currentStat.statProperty;
// Format the custom stat according to the player stat lookup table.
var getFormattedStat = function (val) {
if (val === undefined) { // Return null if there is no value for that stat.
return;
} else {
if (!isNaN(val)) { // Only process numbers.
val = String(val.toFixed(currentStat.precision));
// Remove leading zero.
if (currentStat.leadingZeroFlg && val.startsWith('0')) {
val = val.substr(1, val.length-1);
}
// Add a % sign to the end of the stat.
if (currentStat.percentFlg) {
val += '%';
}
}
return val;
}
}
return { name: displayName, fullName: onHoverName, property: statProperty, format: getFormattedStat };
}
// Add a definition for each of the custom columns.
for (var i = 0; i < userColumns.length; i++) {
columnDefs.push(getCustomColumnDef(userColumns[i]));
}
return columnDefs;
}
// Store the list of defintions by stat type.
vm.statColumnDefs[statTypeKey] = getStatColumnDefs(userSelectedStats);
}
}
}
angular
.module('players')
.controller('PlayerProfileStatsCtrl', [ '$q', 'ColumnService', 'LookupService', 'PlayerService', 'PlayerStatsService', PlayerProfileStatsCtrl ])
})();
javascript angular.js statistics promise controller
3
Note: Crockford says a lot of things. They are not all correct. Function hoisting is probably one of those times.
– Dan Pantry
Jun 28 '16 at 15:52
Do you still maintain this code? If so, could you provide context for thePlayerStatsService
andLookupService
, along with their methods?
– Sᴀᴍ Onᴇᴌᴀ
Jun 27 at 22:06
I do not anymore
– Albert Orlando
Sep 22 at 15:02
add a comment |
up vote
7
down vote
favorite
up vote
7
down vote
favorite
I'm somewhat new to JavaScript and AngularJS, and read in Doug Crockford's book that the hoisting function declaration can lead to issues. Any pointers on how to structure my file would be much appreciated.
(function() {
'use strict';
function PlayerProfileStatsCtrl($q, ColumnService, LookupService, PlayerService, PlayerStatsService) {
var vm = this;
var loadStats = function (player) {
$q.all({
catchingStats: PlayerStatsService.getCatchingStats(player.playerId),
fieldingStats: PlayerStatsService.getFieldingStats(player.playerId),
hittingStats: PlayerStatsService.getHittingStats(player.playerId),
pitchingStats: PlayerStatsService.getPitchingStats(player.playerId),
playerStats: LookupService.getByKeyPromise('lkplayerstat'),
statTypes: LookupService.getListPromise('lkstattype')
}).then(function (results) {
// Associate stat result lists with string keyed stat types.
vm.statResults = {
C: results.catchingStats.statList,
F: results.fieldingStats.statList,
H: results.hittingStats.statList,
P: results.pitchingStats.statList
};
// Assign the player stat lookup object.
vm.playerStats = results.playerStats;
// Assign the stat type lookup list.
vm.statTypes = results.statTypes;
initStatColumnDefs();
});
};
// Call loadStats() after the player promise is resolved.
vm.player = PlayerService.getPlayer(loadStats);
var initStatColumnDefs = function () {
// The column definitions are contained in lists and associated by stat type.
vm.statColumnDefs = {};
for (var i = 0; i < vm.statTypes.length; i++) {
// Get the current stat type key: { 'C', 'F', 'H', 'P' }
var statTypeKey = vm.statTypes[i].statTypeLk;
// Get the list of column names from the user.
var userSelectedStats = ColumnService.getColumns('STATS_' + statTypeKey);
var getStatColumnDefs = function (userColumns) {
var columnDefs = ;
// Each stat section will start with these columns.
columnDefs.push({ name: 'Season', fullName: 'Season', property: 'statDb.year' });
columnDefs.push({ name: 'Team', fullName: 'Team', property: 'team.teamName' });
columnDefs.push({ name: 'Level', fullName: 'Level', property: 'level.shortDescription' });
// Fielding has an additional column in before custom columns are displayed.
if (statTypeKey === 'F') {
columnDefs.push({ name: 'Pos', fullName: 'Position', property: 'statDb.positionLk' });
}
// Construct a custom stat column definition.
var getCustomColumnDef = function (userColumn) {
var currentStat = vm.playerStats[userColumn];
var displayName = currentStat.shortDescription;
var onHoverName = currentStat.description;
var statProperty = 'statDb.' + currentStat.statProperty;
// Format the custom stat according to the player stat lookup table.
var getFormattedStat = function (val) {
if (val === undefined) { // Return null if there is no value for that stat.
return;
} else {
if (!isNaN(val)) { // Only process numbers.
val = String(val.toFixed(currentStat.precision));
// Remove leading zero.
if (currentStat.leadingZeroFlg && val.startsWith('0')) {
val = val.substr(1, val.length-1);
}
// Add a % sign to the end of the stat.
if (currentStat.percentFlg) {
val += '%';
}
}
return val;
}
}
return { name: displayName, fullName: onHoverName, property: statProperty, format: getFormattedStat };
}
// Add a definition for each of the custom columns.
for (var i = 0; i < userColumns.length; i++) {
columnDefs.push(getCustomColumnDef(userColumns[i]));
}
return columnDefs;
}
// Store the list of defintions by stat type.
vm.statColumnDefs[statTypeKey] = getStatColumnDefs(userSelectedStats);
}
}
}
angular
.module('players')
.controller('PlayerProfileStatsCtrl', [ '$q', 'ColumnService', 'LookupService', 'PlayerService', 'PlayerStatsService', PlayerProfileStatsCtrl ])
})();
javascript angular.js statistics promise controller
I'm somewhat new to JavaScript and AngularJS, and read in Doug Crockford's book that the hoisting function declaration can lead to issues. Any pointers on how to structure my file would be much appreciated.
(function() {
'use strict';
function PlayerProfileStatsCtrl($q, ColumnService, LookupService, PlayerService, PlayerStatsService) {
var vm = this;
var loadStats = function (player) {
$q.all({
catchingStats: PlayerStatsService.getCatchingStats(player.playerId),
fieldingStats: PlayerStatsService.getFieldingStats(player.playerId),
hittingStats: PlayerStatsService.getHittingStats(player.playerId),
pitchingStats: PlayerStatsService.getPitchingStats(player.playerId),
playerStats: LookupService.getByKeyPromise('lkplayerstat'),
statTypes: LookupService.getListPromise('lkstattype')
}).then(function (results) {
// Associate stat result lists with string keyed stat types.
vm.statResults = {
C: results.catchingStats.statList,
F: results.fieldingStats.statList,
H: results.hittingStats.statList,
P: results.pitchingStats.statList
};
// Assign the player stat lookup object.
vm.playerStats = results.playerStats;
// Assign the stat type lookup list.
vm.statTypes = results.statTypes;
initStatColumnDefs();
});
};
// Call loadStats() after the player promise is resolved.
vm.player = PlayerService.getPlayer(loadStats);
var initStatColumnDefs = function () {
// The column definitions are contained in lists and associated by stat type.
vm.statColumnDefs = {};
for (var i = 0; i < vm.statTypes.length; i++) {
// Get the current stat type key: { 'C', 'F', 'H', 'P' }
var statTypeKey = vm.statTypes[i].statTypeLk;
// Get the list of column names from the user.
var userSelectedStats = ColumnService.getColumns('STATS_' + statTypeKey);
var getStatColumnDefs = function (userColumns) {
var columnDefs = ;
// Each stat section will start with these columns.
columnDefs.push({ name: 'Season', fullName: 'Season', property: 'statDb.year' });
columnDefs.push({ name: 'Team', fullName: 'Team', property: 'team.teamName' });
columnDefs.push({ name: 'Level', fullName: 'Level', property: 'level.shortDescription' });
// Fielding has an additional column in before custom columns are displayed.
if (statTypeKey === 'F') {
columnDefs.push({ name: 'Pos', fullName: 'Position', property: 'statDb.positionLk' });
}
// Construct a custom stat column definition.
var getCustomColumnDef = function (userColumn) {
var currentStat = vm.playerStats[userColumn];
var displayName = currentStat.shortDescription;
var onHoverName = currentStat.description;
var statProperty = 'statDb.' + currentStat.statProperty;
// Format the custom stat according to the player stat lookup table.
var getFormattedStat = function (val) {
if (val === undefined) { // Return null if there is no value for that stat.
return;
} else {
if (!isNaN(val)) { // Only process numbers.
val = String(val.toFixed(currentStat.precision));
// Remove leading zero.
if (currentStat.leadingZeroFlg && val.startsWith('0')) {
val = val.substr(1, val.length-1);
}
// Add a % sign to the end of the stat.
if (currentStat.percentFlg) {
val += '%';
}
}
return val;
}
}
return { name: displayName, fullName: onHoverName, property: statProperty, format: getFormattedStat };
}
// Add a definition for each of the custom columns.
for (var i = 0; i < userColumns.length; i++) {
columnDefs.push(getCustomColumnDef(userColumns[i]));
}
return columnDefs;
}
// Store the list of defintions by stat type.
vm.statColumnDefs[statTypeKey] = getStatColumnDefs(userSelectedStats);
}
}
}
angular
.module('players')
.controller('PlayerProfileStatsCtrl', [ '$q', 'ColumnService', 'LookupService', 'PlayerService', 'PlayerStatsService', PlayerProfileStatsCtrl ])
})();
javascript angular.js statistics promise controller
javascript angular.js statistics promise controller
edited 23 mins ago
Sᴀᴍ Onᴇᴌᴀ
8,12861751
8,12861751
asked Jun 28 '16 at 13:47
Albert Orlando
363
363
3
Note: Crockford says a lot of things. They are not all correct. Function hoisting is probably one of those times.
– Dan Pantry
Jun 28 '16 at 15:52
Do you still maintain this code? If so, could you provide context for thePlayerStatsService
andLookupService
, along with their methods?
– Sᴀᴍ Onᴇᴌᴀ
Jun 27 at 22:06
I do not anymore
– Albert Orlando
Sep 22 at 15:02
add a comment |
3
Note: Crockford says a lot of things. They are not all correct. Function hoisting is probably one of those times.
– Dan Pantry
Jun 28 '16 at 15:52
Do you still maintain this code? If so, could you provide context for thePlayerStatsService
andLookupService
, along with their methods?
– Sᴀᴍ Onᴇᴌᴀ
Jun 27 at 22:06
I do not anymore
– Albert Orlando
Sep 22 at 15:02
3
3
Note: Crockford says a lot of things. They are not all correct. Function hoisting is probably one of those times.
– Dan Pantry
Jun 28 '16 at 15:52
Note: Crockford says a lot of things. They are not all correct. Function hoisting is probably one of those times.
– Dan Pantry
Jun 28 '16 at 15:52
Do you still maintain this code? If so, could you provide context for the
PlayerStatsService
and LookupService
, along with their methods?– Sᴀᴍ Onᴇᴌᴀ
Jun 27 at 22:06
Do you still maintain this code? If so, could you provide context for the
PlayerStatsService
and LookupService
, along with their methods?– Sᴀᴍ Onᴇᴌᴀ
Jun 27 at 22:06
I do not anymore
– Albert Orlando
Sep 22 at 15:02
I do not anymore
– Albert Orlando
Sep 22 at 15:02
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Bearing in mind that you claim not to maintain this code anymore1, there are a few suggestions I would have about this code:
define functions and accept parameters- that should allow the nested functions to be moved out... You may be able to utilize Partially applied functions.
catch rejected promises The code calls$q.all()
with 6 promises, yet has nocatch()
callback! If any one of those promises would fail, should the user be notified?
bind function scope instead of assigningvm
UtilizeFunction.prototype.bind()
to set the context ofthis
inside callback functions - like the promise callbacks,initStatColumnDefs()
, etc. Then there is no need to define the extra variablevm
- just usethis
.
Get rid of useless
else
- There is no need to use theelse
in the block cited below. If the conditional of theif
statement evaluates to true then thereturn
will be reached. Otherwise the rest of the code can be executed normally.
if (val === undefined) { // Return null if there is no value for that stat.
return;
} else {
1Baseball player statistics controller
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
});
});
}, "mathjax-editing");
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "196"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f133295%2fbaseball-player-statistics-controller%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Bearing in mind that you claim not to maintain this code anymore1, there are a few suggestions I would have about this code:
define functions and accept parameters- that should allow the nested functions to be moved out... You may be able to utilize Partially applied functions.
catch rejected promises The code calls$q.all()
with 6 promises, yet has nocatch()
callback! If any one of those promises would fail, should the user be notified?
bind function scope instead of assigningvm
UtilizeFunction.prototype.bind()
to set the context ofthis
inside callback functions - like the promise callbacks,initStatColumnDefs()
, etc. Then there is no need to define the extra variablevm
- just usethis
.
Get rid of useless
else
- There is no need to use theelse
in the block cited below. If the conditional of theif
statement evaluates to true then thereturn
will be reached. Otherwise the rest of the code can be executed normally.
if (val === undefined) { // Return null if there is no value for that stat.
return;
} else {
1Baseball player statistics controller
add a comment |
up vote
0
down vote
Bearing in mind that you claim not to maintain this code anymore1, there are a few suggestions I would have about this code:
define functions and accept parameters- that should allow the nested functions to be moved out... You may be able to utilize Partially applied functions.
catch rejected promises The code calls$q.all()
with 6 promises, yet has nocatch()
callback! If any one of those promises would fail, should the user be notified?
bind function scope instead of assigningvm
UtilizeFunction.prototype.bind()
to set the context ofthis
inside callback functions - like the promise callbacks,initStatColumnDefs()
, etc. Then there is no need to define the extra variablevm
- just usethis
.
Get rid of useless
else
- There is no need to use theelse
in the block cited below. If the conditional of theif
statement evaluates to true then thereturn
will be reached. Otherwise the rest of the code can be executed normally.
if (val === undefined) { // Return null if there is no value for that stat.
return;
} else {
1Baseball player statistics controller
add a comment |
up vote
0
down vote
up vote
0
down vote
Bearing in mind that you claim not to maintain this code anymore1, there are a few suggestions I would have about this code:
define functions and accept parameters- that should allow the nested functions to be moved out... You may be able to utilize Partially applied functions.
catch rejected promises The code calls$q.all()
with 6 promises, yet has nocatch()
callback! If any one of those promises would fail, should the user be notified?
bind function scope instead of assigningvm
UtilizeFunction.prototype.bind()
to set the context ofthis
inside callback functions - like the promise callbacks,initStatColumnDefs()
, etc. Then there is no need to define the extra variablevm
- just usethis
.
Get rid of useless
else
- There is no need to use theelse
in the block cited below. If the conditional of theif
statement evaluates to true then thereturn
will be reached. Otherwise the rest of the code can be executed normally.
if (val === undefined) { // Return null if there is no value for that stat.
return;
} else {
1Baseball player statistics controller
Bearing in mind that you claim not to maintain this code anymore1, there are a few suggestions I would have about this code:
define functions and accept parameters- that should allow the nested functions to be moved out... You may be able to utilize Partially applied functions.
catch rejected promises The code calls$q.all()
with 6 promises, yet has nocatch()
callback! If any one of those promises would fail, should the user be notified?
bind function scope instead of assigningvm
UtilizeFunction.prototype.bind()
to set the context ofthis
inside callback functions - like the promise callbacks,initStatColumnDefs()
, etc. Then there is no need to define the extra variablevm
- just usethis
.
Get rid of useless
else
- There is no need to use theelse
in the block cited below. If the conditional of theif
statement evaluates to true then thereturn
will be reached. Otherwise the rest of the code can be executed normally.
if (val === undefined) { // Return null if there is no value for that stat.
return;
} else {
1Baseball player statistics controller
answered 22 mins ago
Sᴀᴍ Onᴇᴌᴀ
8,12861751
8,12861751
add a comment |
add a comment |
Thanks for contributing an answer to Code Review Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f133295%2fbaseball-player-statistics-controller%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
Note: Crockford says a lot of things. They are not all correct. Function hoisting is probably one of those times.
– Dan Pantry
Jun 28 '16 at 15:52
Do you still maintain this code? If so, could you provide context for the
PlayerStatsService
andLookupService
, along with their methods?– Sᴀᴍ Onᴇᴌᴀ
Jun 27 at 22:06
I do not anymore
– Albert Orlando
Sep 22 at 15:02