Skip to content

Commit

Permalink
Code review feedback
Browse files Browse the repository at this point in the history
Fixing fdescribe typo
Switching from direct lodash _.find to Backbone collection .find() calls (which map to lodash _.find).  More consistent with other parts of the codebase.
Fixing utils.ageOfConsent Array.find call, which was missed in original fix.
  • Loading branch information
differentmatt committed Jun 12, 2018
1 parent b51e048 commit 37bb5a6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/core/utils.coffee
Expand Up @@ -98,7 +98,7 @@ inEU = (country) -> !!_.find(countries, (c) => c.country is slugify(country))?.i

ageOfConsent = (countryName, defaultIfUnknown=0) ->
return defaultIfUnknown unless countryName
country = countries.find((c) => c.country is slugify(countryName))
country = _.find(countries, (c) => c.country is slugify(countryName))
return defaultIfUnknown unless country
return country.ageOfConsent if country.ageOfConsent
return 16 if country.inEU
Expand Down
2 changes: 1 addition & 1 deletion app/views/courses/TeacherCoursesView.coffee
Expand Up @@ -48,7 +48,7 @@ module.exports = class TeacherCoursesView extends RootView
levels = campaign.getLevels().models.map (level) =>
key: level.get('original'), practice: level.get('practice') ? false, assessment: level.get('assessment') ? false
@campaignLevelNumberMap[campaign.id] = utils.createLevelNumberMap(levels)
@paidTeacher = @paidTeacher or _.find(@prepaids?.models, (m) => m.get('type') in ['course', 'starter_license'] and m.get('maxRedeemers') > 0)?
@paidTeacher = @paidTeacher or @prepaids.find((p) => p.get('type') in ['course', 'starter_license'] and p.get('maxRedeemers') > 0)?
@render?()

onClickGuideButton: (e) ->
Expand Down
2 changes: 1 addition & 1 deletion app/views/teachers/TeacherCourseSolutionView.coffee
Expand Up @@ -49,7 +49,7 @@ module.exports = class TeacherCourseSolutionView extends RootView
a

onLoaded: ->
@paidTeacher = @paidTeacher or _.find(@prepaids?.models, (m) => m.get('type') in ['course', 'starter_license'] and m.get('maxRedeemers') > 0)?
@paidTeacher = @paidTeacher or @prepaids.find((p) => p.get('type') in ['course', 'starter_license'] and p.get('maxRedeemers') > 0)?
@listenTo me, 'change:preferredLanguage', @updateLevelData
@updateLevelData()

Expand Down
2 changes: 1 addition & 1 deletion test/app/core/utils.spec.coffee
Expand Up @@ -65,7 +65,7 @@ describe 'Utility library', ->
it 'i18n can fall forward if a general language is not found', ->
expect(utils.i18n(this.fixture1, 'text', 'pt')).toEqual(this.fixture1.i18n['pt-BR'].text)

fdescribe 'inEU', ->
describe 'inEU', ->
it 'EU countries return true', ->
euCountries = ['Austria', 'Belgium', 'Bulgaria', 'Croatia', 'Cyprus', 'Czech Republic', 'Denmark', 'Estonia', 'Finland', 'France', 'Germany', 'Greece', 'Hungary', 'Ireland', 'Italy', 'Latvia', 'Lithuania', 'Luxembourg', 'Malta', 'Netherlands', 'Poland', 'Portugal', 'Romania', 'Slovakia', 'Slovenia', 'Spain', 'Sweden', 'United Kingdom']
try
Expand Down

0 comments on commit 37bb5a6

Please sign in to comment.