From c74a8a7fc0d9a5cb041a99500a77312e617799ce Mon Sep 17 00:00:00 2001 From: terakilobyte Date: Mon, 25 May 2015 23:27:21 -0400 Subject: [PATCH 1/3] Consisten dasherization in stories. Updated story cleanup script. --- controllers/story.js | 7 +++---- seed_data/storyCleanup.js | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/controllers/story.js b/controllers/story.js index 233f929b692..3a34c7b8838 100755 --- a/controllers/story.js +++ b/controllers/story.js @@ -137,7 +137,9 @@ exports.returnIndividualStory = function(req, res, next) { } story = story.pop(); - var dashedNameFull = story.storyLink.toLowerCase().replace(/\s/g, '-'); + var dashedNameFull = story.storyLink.toLowerCase() + .replace(/\s+/g, ' ') + .replace(/\s/g, '-'); if (dashedNameFull !== dashedName) { return res.redirect('../news/' + dashedNameFull); } @@ -328,9 +330,6 @@ exports.storySubmission = function(req, res, next) { return next(new Error('Not authorized')); } var storyLink = data.headline - .replace(/\'/g, '') - .replace(/\"/g, '') - .replace(/,/g, '') .replace(/\s+/g, ' ') .replace(/[^a-z0-9\s]/gi, '') .toLowerCase() diff --git a/seed_data/storyCleanup.js b/seed_data/storyCleanup.js index 2598526c8a5..c216e672937 100644 --- a/seed_data/storyCleanup.js +++ b/seed_data/storyCleanup.js @@ -18,8 +18,8 @@ function storyLinkCleanup(cb) { console.log(i++); this.pause(); story.storyLink = story.storyLink. - replace(/[^a-z0-9\s]/gi, ''). replace(/\s+/g, ' '). + replace(/[^a-z0-9\s]/gi, ''). toLowerCase(). trim(); story.save(function (err) { From 47d350aa276185182aa6e6e4dcf312e0ad260426 Mon Sep 17 00:00:00 2001 From: terakilobyte Date: Tue, 26 May 2015 00:04:50 -0400 Subject: [PATCH 2/3] update instructions for Bonfire: Mutations --- seed_data/challenges/basic-bonfires.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/seed_data/challenges/basic-bonfires.json b/seed_data/challenges/basic-bonfires.json index e9a01a9a3dd..0e5ca681cca 100644 --- a/seed_data/challenges/basic-bonfires.json +++ b/seed_data/challenges/basic-bonfires.json @@ -349,10 +349,11 @@ "name": "Bonfire: Mutations", "difficulty": "1.12", "description": [ - "Return true if the string in the first element of the array contains the letters of the string in the second element of the array.", + "Return true if the string in the first element of the array contains the all of the letters of the string in the second element of the array.", "For example, ['hello', 'Hello'], should return true because all of the letters in the second string are present in the first, ignoring case.", "The arguments ['hello', 'hey'] should return false because the string 'hello' does not contain a 'y'.", "Another example, ['Alien', 'line'], should return true because all of the letters in 'line' are present in 'Alien'.", + "Lastly, ['Mary', 'Aarmy'] should return false because 'Mary' is only 4 letters while 'Aarmy' is 5, so 'Mary' can't possibly contain 'Aarmy'", "Remember to use RSAP if you get stuck. Try to pair program. Write your own code." ], "challengeSeed": [ @@ -367,6 +368,7 @@ "expect(mutation(['hello', 'Hello'])).to.be.true;", "expect(mutation(['zyxwvutsrqponmlkjihgfedcba', 'qrstu'])).to.be.true;", "expect(mutation(['Mary', 'Army'])).to.be.true;", + "expect(mutation(['Mary', 'Aarmy'])).to.be.false;", "expect(mutation(['Alien', 'line'])).to.be.true;" ], "MDNlinks": ["Array.sort()"], From ac304bd59c64d7185e312ce9fa9e3dbdf017c7d4 Mon Sep 17 00:00:00 2001 From: terakilobyte Date: Tue, 26 May 2015 00:07:10 -0400 Subject: [PATCH 3/3] Fix grammatical error in Mutations instructions --- seed_data/challenges/basic-bonfires.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed_data/challenges/basic-bonfires.json b/seed_data/challenges/basic-bonfires.json index 0e5ca681cca..907fc7af9b2 100644 --- a/seed_data/challenges/basic-bonfires.json +++ b/seed_data/challenges/basic-bonfires.json @@ -349,7 +349,7 @@ "name": "Bonfire: Mutations", "difficulty": "1.12", "description": [ - "Return true if the string in the first element of the array contains the all of the letters of the string in the second element of the array.", + "Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array.", "For example, ['hello', 'Hello'], should return true because all of the letters in the second string are present in the first, ignoring case.", "The arguments ['hello', 'hey'] should return false because the string 'hello' does not contain a 'y'.", "Another example, ['Alien', 'line'], should return true because all of the letters in 'line' are present in 'Alien'.",