diff --git a/challenge-migration.js b/challenge-migration.js deleted file mode 100644 index 7ef359781f..0000000000 --- a/challenge-migration.js +++ /dev/null @@ -1,44 +0,0 @@ -require('dotenv').load(); -var bonfires = require('./bonfires.json'), - app = require('../server/server'), - mongodb = require('mongodb'), - MongoClient = mongodb.MongoClient, - User = app.models.User, - UserIdentity = app.models.userIdentity, - oldUri='mongodb://localhost:27017/app30893198', - coursewares = require('./coursewares.json'); - -MongoClient.connect(oldUri, function(err, database) { - - database.collection('users').find({}).batchSize(20).toArray(function(err, users) { - if (users !== null && users.length !== 0) { - var mappedUserArray = users.map(function(user) { - Object.keys(user.profile).forEach(function(prop) { - user[prop] = user.profile[prop]; - }); - Object.keys(user.portfolio).forEach(function(prop) { - user[prop] = user.portfolio[prop]; - }); - - user.completedCoursewares = Object.keys(user.challengesHash) - .filter(function(key) { - return user.challengesHash[key] !== 0; - }) - .map(function(key) { - return({ - id: coursewares[key].id, - completedDate: user.challengesHash[key] - }); - }); - - return user; - }); - User.create(mappedUserArray, function(err) { - if (err) { - console.log(err); - } - console.log("a batch finished"); - }); - } - }); -}); diff --git a/challengeMapping.json b/challengeMapping.json deleted file mode 100644 index db6686d266..0000000000 --- a/challengeMapping.json +++ /dev/null @@ -1,226 +0,0 @@ -[ - { - "oldNumber": "0", - "newId": "bd7124d8c441eddfaeb5bdef" - }, - { - "oldNumber": "1", - "newId": "bd7125d8c441eddfaeb5bd0f" - }, - { - "oldNumber": "2", - "newId": "" - }, - { - "oldNumber": "3", - "newId": "bd7127d8c441eddfaeb5bdef" - }, - { - "oldNumber": "4", - "newId": "bd7128d8c441eddfaeb5bdef" - }, - { - "oldNumber": "5", - "newId": "bd8129d8c441eddfaeb5bdef" - }, - { - "oldNumber": "6", - "newId": "" - }, - { - "oldNumber": "7", - "newId": "" - }, - { - "oldNumber": "8", - "newId": "bd7112d8c441eddfaeb5bdef" - }, - { - "oldNumber": "9", - "newId": "bd7113d8c441eddfaeb5bdef" - }, - { - "oldNumber": "10", - "newId": "bd7114d8c441eddfaeb5bdef" - }, - { - "oldNumber": "11", - "newId": "bd7115d8c441eddfaeb5bdef" - }, - { - "oldNumber": "12", - "newId": "bd7116d8c441eddfaeb5bdef" - }, - { - "oldNumber": "13", - "newId": "bd7117d8c441eddfaeb5bdef" - }, - { - "oldNumber": "14", - "newId": "bd7118d8c441eddfaeb5bdef" - }, - { - "oldNumber": "15", - "newId": "" - }, - { - "oldNumber": "16", - "newId": "" - }, - { - "oldNumber": "17", - "newId": "" - }, - { - "oldNumber": "18", - "newId": "" - }, - { - "oldNumber": "19", - "newId": "bd7123d8c441eddfaeb5bdef" - }, - { - "oldNumber": "20", - "newId": "bd8124d8c441eddfaeb5bdef" - }, - { - "oldNumber": "21", - "newId": "bd8126d8c441eddfaeb5bdef" - }, - { - "oldNumber": "22", - "newId": "bd8127d8c441eddfaeb5bdef" - }, - { - "oldNumber": "23", - "newId": "bd8128d8c441eddfaeb5bdef" - }, - { - "oldNumber": "24", - "newId": "bd7129d8c441eddfaeb5bdef" - }, - { - "oldNumber": "25", - "newId": "bd7130d8c441eddfaeb5bdef" - }, - { - "oldNumber": "26", - "newId": "bd7131d8c441eddfaeb5bdef" - }, - { - "oldNumber": "27", - "newId": "bd7132d8c441eddfaeb5bdef" - }, - { - "oldNumber": "28", - "newId": "bd7133d8c441eddfaeb5bdef" - }, - { - "oldNumber": "29", - "newId": "bd7134d8c441eddfaeb5bdef" - }, - { - "oldNumber": "30", - "newId": "bd7135d8c441eddfaeb5bdef" - }, - { - "oldNumber": "31", - "newId": "bd7136d8c441eddfaeb5bdef" - }, - { - "oldNumber": "32", - "newId": "" - }, - { - "oldNumber": "33", - "newId": "bd7138d8c441eddfaeb5bdef" - }, - { - "oldNumber": "34", - "newId": "bd7137d8c441eddfaeb5bdef" - }, - { - "oldNumber": "35", - "newId": "bd7140d8c441eddfaeb5bdef" - }, - { - "oldNumber": "36", - "newId": "" - }, - { - "oldNumber": "37", - "newId": "" - }, - { - "oldNumber": "38", - "newId": "" - }, - { - "oldNumber": "39", - "newId": "" - }, - { - "oldNumber": "40", - "newId": "" - }, - { - "oldNumber": "41", - "newId": "" - }, - { - "oldNumber": "42", - "newId": "" - }, - { - "oldNumber": "43", - "newId": "" - }, - { - "oldNumber": "44", - "newId": "" - }, - { - "oldNumber": "45", - "newId": "" - }, - { - "oldNumber": "46", - "newId": "" - }, - { - "oldNumber": "47", - "newId": "" - }, - { - "oldNumber": "48", - "newId": "bd7153d8c441eddfaeb5bd2f" - }, - { - "oldNumber": "49", - "newId": "bd7154d8c441eddfaeb5bdef" - }, - { - "oldNumber": "50", - "newId": "bd7155d8c441eddfaeb5bdef" - }, - { - "oldNumber": "51", - "newId": "bd7156d8c441eddfaeb5bdef" - }, - { - "oldNumber": "52", - "newId": "bd7157d8c441eddfaeb5bdef" - }, - { - "oldNumber": "53", - "newId": "bd7158d8c441eddfaeb5bdef" - }, - { - "oldNumber": "54", - "newId": "" - }, - { - "oldNumber": "55", - "newId": "" - } -] diff --git a/jobs.json b/jobs.json deleted file mode 100644 index 5850dc8aba..0000000000 --- a/jobs.json +++ /dev/null @@ -1,47 +0,0 @@ -[ - { - "id": "bd7167d8c441cbafaeb5bdef", - "email": "Ada_Gerlach@gmail.com", - "phone": "1-140-557-0727", - "company": "Livestream", - "country": "Singapore", - "city": "Morar berg", - "state": "South Dakota", - "position": "Junior Backend Developer (Node.js)", - "logo": "https://s3.amazonaws.com/prod-heroku/greenhouse_job_boards/logos/000/001/189/resized/livestream_logo-rgb_standard-cc718e67ce1a0f6fa400f609bdefe605.png?1429547161", - "description": "Live life one inhalation and one exhalation at a time. May you be healthy. Let the muscles in your neck and shoulders relax. May you be safe. Reflect on the fragility and preciousness of life. Empty your mind; be formless, shapeless like water. May you be at peace. Take a deep breath. You can do what you set out to do; yes, you can. You can do what you set out to do; yes, you can. Watch each breath appear and disappear, just breathing. Give yourself a break. Live life one inhalation and one exhalation at a time. Give yourself a break. Just acknowledge what's there and let be. You can get through this. Open your heart to change, forgiveness and lovingkindness. Love is the first seed of the soul. It will be ok. Impermanence and change is a powerful teacher and teaching. Bring love into your heart, into your breath and into your being. Briefly notice any emotions, thoughts or sensations that may be driving fear and anxiety and let them be. This discomfort will pass. Bring love into your heart, into your breath and into your being. Take a deep breath. Reflect on the fragility and preciousness of life." - }, - { - "id": "bd7167d8c442cbafaeb5bdef", - "email": "Ada_Gerlach@gmail.com", - "company": "Adobe", - "country": "Singapore", - "city": "Morar berg", - "state": "South Dakota", - "position": "Junior JavaScript Engineer", - "logo": "http://cdn-3.famouslogos.us/images/adobe-logo.jpg", - "description": "Live life one inhalation and one exhalation at a time. May you be healthy. Let the muscles in your neck and shoulders relax. May you be safe. Reflect on the fragility and preciousness of life. Empty your mind; be formless, shapeless like water. May you be at peace. Take a deep breath. You can do what you set out to do; yes, you can. You can do what you set out to do; yes, you can. Watch each breath appear and disappear, just breathing. Give yourself a break. Live life one inhalation and one exhalation at a time. Give yourself a break. Just acknowledge what's there and let be. You can get through this. Open your heart to change, forgiveness and lovingkindness. Love is the first seed of the soul. It will be ok. Impermanence and change is a powerful teacher and teaching. Bring love into your heart, into your breath and into your being. Briefly notice any emotions, thoughts or sensations that may be driving fear and anxiety and let them be. This discomfort will pass. Bring love into your heart, into your breath and into your being. Take a deep breath. Reflect on the fragility and preciousness of life." - }, - { - "id": "bd7167d8c443cbafaeb5bdef", - "phone": "1-140-557-0727", - "company": "Bookspan", - "country": "Singapore", - "city": "Morar berg", - "state": "South Dakota", - "position": "Full Stack JavaScript Developer (Junior)", - "logo": "https://tm-prod.global.ssl.fastly.net/uploaded/companies/227/small_logo.png?v=db9dbe", - "description": "Live life one inhalation and one exhalation at a time. May you be healthy. Let the muscles in your neck and shoulders relax. May you be safe. Reflect on the fragility and preciousness of life. Empty your mind; be formless, shapeless like water. May you be at peace. Take a deep breath. You can do what you set out to do; yes, you can. You can do what you set out to do; yes, you can. Watch each breath appear and disappear, just breathing. Give yourself a break. Live life one inhalation and one exhalation at a time. Give yourself a break. Just acknowledge what's there and let be. You can get through this. Open your heart to change, forgiveness and lovingkindness. Love is the first seed of the soul. It will be ok. Impermanence and change is a powerful teacher and teaching. Bring love into your heart, into your breath and into your being. Briefly notice any emotions, thoughts or sensations that may be driving fear and anxiety and let them be. This discomfort will pass. Bring love into your heart, into your breath and into your being. Take a deep breath. Reflect on the fragility and preciousness of life." - }, - { - "id": "bd7167d8c444cbafaeb5bdef", - "email": "Ada_Gerlach@gmail.com", - "company": "Good Eggs", - "country": "Singapore", - "city": "Morar berg", - "state": "South Dakota", - "position": "Full Stack Developer", - "logo": "https://d1qb2nb5cznatu.cloudfront.net/startups/i/72165-64efbd521cdfe3357c811758f5436e7d-medium_jpg.jpg", - "description": "Live life one inhalation and one exhalation at a time. May you be healthy. Let the muscles in your neck and shoulders relax. May you be safe. Reflect on the fragility and preciousness of life. Empty your mind; be formless, shapeless like water. May you be at peace. Take a deep breath. You can do what you set out to do; yes, you can. You can do what you set out to do; yes, you can. Watch each breath appear and disappear, just breathing. Give yourself a break. Live life one inhalation and one exhalation at a time. Give yourself a break. Just acknowledge what's there and let be. You can get through this. Open your heart to change, forgiveness and lovingkindness. Love is the first seed of the soul. It will be ok. Impermanence and change is a powerful teacher and teaching. Bring love into your heart, into your breath and into your being. Briefly notice any emotions, thoughts or sensations that may be driving fear and anxiety and let them be. This discomfort will pass. Bring love into your heart, into your breath and into your being. Take a deep breath. Reflect on the fragility and preciousness of life." - } -] diff --git a/storyCleanup.js b/storyCleanup.js deleted file mode 100644 index 2598526c8a..0000000000 --- a/storyCleanup.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Created by nathanleniz on 4/25/15. - */ -require('dotenv').load(); -var mongodb = require('mongodb'), - Story = require('../models/Story.js'), - secrets = require('../config/secrets'); - mongoose = require('mongoose'); - -mongoose.connect(secrets.db); - -function storyLinkCleanup(cb) { - console.log('headLineCleanup'); - var i = 1; - var stream = Story.find({}).skip(0).limit(0).batchSize(20000).stream(); - - stream.on('data', function (story) { - console.log(i++); - this.pause(); - story.storyLink = story.storyLink. - replace(/[^a-z0-9\s]/gi, ''). - replace(/\s+/g, ' '). - toLowerCase(). - trim(); - story.save(function (err) { - if (err) { - console.log('woops'); - } - this.resume(); - }.bind(this)); - }) - .on('error', function (err) { - console.error(err); - }).on('close', function () { - console.log('done with set'); - stream.destroy(); - cb(); - }); -} - -function done() { - console.log('Migration script has completed'); - process.exit(0); -} - - -storyLinkCleanup(done); diff --git a/userMigration.js b/userMigration.js deleted file mode 100644 index 350a57ffe3..0000000000 --- a/userMigration.js +++ /dev/null @@ -1,137 +0,0 @@ -/*eslint-disable block-scoped-var */ -require('dotenv').load(); -var User = require('../models/User.js'), - secrets = require('../config/secrets'), - mongoose = require('mongoose'), - R = require('ramda'), - ziplines = require('./challenges/ziplines.json'), - basejumps = require('./challenges/basejumps.json'); - -mongoose.connect(secrets.db); - -var ziplineIds = ziplines.challenges.map(function(elem) { - return elem.id; -}); -var basejumpIds = basejumps.challenges.map(function(elem) { - return elem.id; -}); -var ziplineAndBaseJumpIds = R.concat(ziplineIds, basejumpIds); - -function userModelAssurity(cb) { - console.log('userModelAssurity'); - var i = 1; - var stream = User.find({}).skip(0).limit(0).batchSize(20000).stream(); - - stream.on('data', function (user) { - console.log(i++); - this.pause(); - user.needsMigration = true; - user.save(function (err) { - if (err) { - console.log('woops'); - } - this.resume(); - }.bind(this)); - }) - .on('error', function (err) { - console.log(err); - }).on('close', function () { - console.log('done with set'); - stream.destroy(); - cb(); - }); -} - -function migrateIt() { - console.log('migrateIt'); - var dones = 0; - var done = function() { - dones++; - if (dones === 2) { - process.exit(0); - } - if (dones === 1) { - userModelMigration(done); - } - }; - console.log('calling userModelAssurity'); - userModelAssurity(done); -} - -function userModelMigration(cb) { - - var i = 1; - - var stream = User.find({needsMigration: true}).skip(0).limit(0) - .batchSize(20000).stream(); - - stream.on('data', function (user) { - console.log(i++); - /* - if (user.challengesHash) { - this.pause(); - user.needsMigration = false; - var oldChallenges = Object.keys(user.challengesHash).filter(function (key) { - if (user.challengesHash[key]) { - user.progressTimestamps.push(user.challengesHash[key] * 1000); - } - return user.challengesHash[key]; - }); - - newChallenges.forEach(function (challenge) { - if (oldChallenges.indexOf(challenge.oldNumber) !== -1 && challenge.newId) { - user.completedCoursewares.push({ - id: challenge.newId, - completedDate: user.challengesHash[challenge.oldNumber] * 1000 - }); - } - }); - - user.completedCoursewares.forEach(function (course) { - var indexOfCourse = user.uncompletedCoursewares.indexOf(course.id) !== -1; - if (indexOfCourse !== -1) { - user.uncompletedCoursewares.splice(indexOfCourse, 1); - } - }); - - user.completedBonfires.forEach(function (bonfire) { - bonfire.completedDate = bonfire.completedDate * 1000; - user.progressTimestamps.push(bonfire.completedDate); - }); - } - */ - user.needsMigration = false; - user.completedChallenges = user.completedChallenges.map(function(elem) { - if (ziplineAndBaseJumpIds.indexOf(elem.id) > 0) { - return ({ - id: elem.id, - name: elem.name, - completedWith: elem.completedWith, - completedDate: elem.completedDate, - solution: elem.solution, - githubLink: elem.githubLink, - verified: elem.verified, - challengeType: typeof elem.githubLink === 'boolean' ? 4 : 3 - }); - } else { - return elem; - } - }); - - var self = this; - user.save(function (err) { - if (err) { - console.log('woops'); - } - self.resume(); - }); - }).on('error', function (err) { - console.log(err); - }).on('close', function () { - console.log('done with set'); - stream.destroy(); - cb(); - }); -} - -migrateIt();