Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes slugs for some badges to keep them consistent with badgekit data #211

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified bin/badgekit_to_badgr/badges_only.local.sqlite3
Binary file not shown.
20 changes: 2 additions & 18 deletions bin/badgekit_to_badgr/migrateBKtoBS.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,15 @@ var bkDB = new sqlite3.Database('badgekit.db', function(err){
function lookUpBadgeData(badgesList, dataItem) {
var badgeData = {};
badgesList.forEach(function(item){
// A few of the slugs are different in the two databases, in some cases the difference is just an underscore, but
// in other cases (like the three below) the full name is different. The ones without difference are taken care of
// in the first if statement.
if (item.slug.replace(/-/g, '') === dataItem.slug.replace(/_/g, '')) {
badgeData = { 'image': item.image, 'id': item.id };
}

if (item.slug === 'funding-acquisition' && dataItem.slug === 'funding' ) {
badgeData = { 'image': item.image, 'id': item.id };
}

if (item.slug === 'writing-original-draft' && dataItem.slug === 'writing_initial' ) {
badgeData = { 'image': item.image, 'id': item.id };
}

if (item.slug === 'writing-review-editing' && dataItem.slug === 'writing_review' ) {
badgeData = { 'image': item.image, 'id': item.id };
if (item.slug === dataItem.slug) {
badgeData = {'image': item.image, 'id': item.id};
}
});

return badgeData;
}

function insertToInstance(badgesIdSlug, data) {
console.info(data);
var badgeData = lookUpBadgeData(badgesIdSlug, data);

var serverUrl = env.get('BADGR_ENDPOINT') + 'public/';
Expand Down