-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Renames Curatr to Stream (#1476 - [LL-217](https://learningpool.…
- Loading branch information
1 parent
ebd9561
commit 5db0c98
Showing
63 changed files
with
345 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import logger from 'lib/logger'; | ||
import Dashboard from 'lib/models/dashboard'; | ||
|
||
export const renameCuratrDashboardsToStream = async () => { | ||
try { | ||
const dashboards = await Dashboard.find( | ||
{ | ||
title: { $regex: 'Curatr', $options: 'g' } | ||
} | ||
); | ||
|
||
for (const dashboard of dashboards) { | ||
dashboard.title = dashboard.title.replace('Curatr', 'Stream'); | ||
|
||
await dashboard.save(); | ||
} | ||
} catch (error) { | ||
logger.error(error); | ||
} | ||
}; | ||
|
||
export const renameStreamDashboardsToCuratr = async () => { | ||
try { | ||
const dashboards = await Dashboard.find( | ||
{ | ||
title: { $regex: 'Stream', $options: 'g' } | ||
} | ||
); | ||
|
||
for (const dashboard of dashboards) { | ||
dashboard.title = dashboard.title.replace('Stream', 'Curatr'); | ||
|
||
await dashboard.save(); | ||
} | ||
} catch (error) { | ||
logger.error(error); | ||
} | ||
}; |
67 changes: 67 additions & 0 deletions
67
cli/src/commands/migrateCuratrVisualisationTemplateTypesToStream.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { invert } from 'lodash'; | ||
|
||
import Visualisation from 'lib/models/visualisation'; | ||
import logger from 'lib/logger'; | ||
|
||
// Old name constants | ||
const TEMPLATE_CURATR_INTERACTIONS_VS_ENGAGEMENT = 'TEMPLATE_CURATR_INTERACTIONS_VS_ENGAGEMENT'; | ||
const TEMPLATE_CURATR_COMMENT_COUNT = 'TEMPLATE_CURATR_COMMENT_COUNT'; | ||
const TEMPLATE_CURATR_LEARNER_INTERACTIONS_BY_DATE_AND_VERB = 'TEMPLATE_CURATR_LEARNER_INTERACTIONS_BY_DATE_AND_VERB'; | ||
const TEMPLATE_CURATR_USER_ENGAGEMENT_LEADERBOARD = 'TEMPLATE_CURATR_USER_ENGAGEMENT_LEADERBOARD'; | ||
const TEMPLATE_CURATR_PROPORTION_OF_SOCIAL_INTERACTIONS = 'TEMPLATE_CURATR_PROPORTION_OF_SOCIAL_INTERACTIONS'; | ||
const TEMPLATE_CURATR_ACTIVITIES_WITH_MOST_COMMENTS = 'TEMPLATE_CURATR_ACTIVITIES_WITH_MOST_COMMENTS'; | ||
|
||
// New name constants | ||
const TEMPLATE_STREAM_INTERACTIONS_VS_ENGAGEMENT = 'TEMPLATE_STREAM_INTERACTIONS_VS_ENGAGEMENT'; | ||
const TEMPLATE_STREAM_COMMENT_COUNT = 'TEMPLATE_STREAM_COMMENT_COUNT'; | ||
const TEMPLATE_STREAM_LEARNER_INTERACTIONS_BY_DATE_AND_VERB = 'TEMPLATE_STREAM_LEARNER_INTERACTIONS_BY_DATE_AND_VERB'; | ||
const TEMPLATE_STREAM_USER_ENGAGEMENT_LEADERBOARD = 'TEMPLATE_STREAM_USER_ENGAGEMENT_LEADERBOARD'; | ||
const TEMPLATE_STREAM_PROPORTION_OF_SOCIAL_INTERACTIONS = 'TEMPLATE_STREAM_PROPORTION_OF_SOCIAL_INTERACTIONS'; | ||
const TEMPLATE_STREAM_ACTIVITIES_WITH_MOST_COMMENTS = 'TEMPLATE_STREAM_ACTIVITIES_WITH_MOST_COMMENTS'; | ||
|
||
const oldToNewRenameMap = { | ||
[TEMPLATE_CURATR_INTERACTIONS_VS_ENGAGEMENT]: TEMPLATE_STREAM_INTERACTIONS_VS_ENGAGEMENT, | ||
[TEMPLATE_CURATR_COMMENT_COUNT]: TEMPLATE_STREAM_COMMENT_COUNT, | ||
[TEMPLATE_CURATR_LEARNER_INTERACTIONS_BY_DATE_AND_VERB]: TEMPLATE_STREAM_LEARNER_INTERACTIONS_BY_DATE_AND_VERB, | ||
[TEMPLATE_CURATR_USER_ENGAGEMENT_LEADERBOARD]: TEMPLATE_STREAM_USER_ENGAGEMENT_LEADERBOARD, | ||
[TEMPLATE_CURATR_PROPORTION_OF_SOCIAL_INTERACTIONS]: TEMPLATE_STREAM_PROPORTION_OF_SOCIAL_INTERACTIONS, | ||
[TEMPLATE_CURATR_ACTIVITIES_WITH_MOST_COMMENTS]: TEMPLATE_STREAM_ACTIVITIES_WITH_MOST_COMMENTS | ||
}; | ||
|
||
const newToOldRenameMap = invert(oldToNewRenameMap); | ||
|
||
export const renameCuratrTemplateTypesToStream = async () => { | ||
try { | ||
const visualisations = await Visualisation.find( | ||
{ | ||
type: { $in: Object.keys(oldToNewRenameMap) } | ||
} | ||
); | ||
|
||
for (const visualisation of visualisations) { | ||
visualisation.type = oldToNewRenameMap[visualisation.type]; | ||
|
||
await visualisation.save(); | ||
} | ||
} catch (error) { | ||
logger.error(error); | ||
} | ||
}; | ||
|
||
export const renameStreamTemplateTypesToCuratr = async () => { | ||
try { | ||
const visualisations = await Visualisation.find( | ||
{ | ||
type: { $in: Object.keys(newToOldRenameMap) } | ||
} | ||
); | ||
|
||
for (const visualisation of visualisations) { | ||
visualisation.type = newToOldRenameMap[visualisation.type]; | ||
|
||
await visualisation.save(); | ||
} | ||
} catch (error) { | ||
logger.error(error); | ||
} | ||
}; |
14 changes: 14 additions & 0 deletions
14
cli/src/commands/v2-migrations/20200227000000_rename_curatr_vis_tpl_types_to_stream.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { | ||
renameCuratrTemplateTypesToStream, | ||
renameStreamTemplateTypesToCuratr | ||
} from 'cli/commands/migrateCuratrVisualisationTemplateTypesToStream'; | ||
|
||
const up = async () => { | ||
await renameCuratrTemplateTypesToStream(); | ||
}; | ||
|
||
const down = async () => { | ||
await renameStreamTemplateTypesToCuratr(); | ||
}; | ||
|
||
export default { up, down }; |
15 changes: 15 additions & 0 deletions
15
cli/src/commands/v2-migrations/20200228000000_rename_curatr_dashboards_to_stream.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { | ||
renameCuratrDashboardsToStream, | ||
renameStreamDashboardsToCuratr | ||
} from 'cli/commands/migrateCuratrDashboardsToStream'; | ||
|
||
|
||
const up = async () => { | ||
await renameCuratrDashboardsToStream(); | ||
}; | ||
|
||
const down = async () => { | ||
await renameStreamDashboardsToCuratr(); | ||
}; | ||
|
||
export default { up, down }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...trActivitiesWithMostComments/constants.js → ...amActivitiesWithMostComments/constants.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { LEADERBOARD_GREY_IMAGE } from 'ui/components/VisualiseIcon/assets'; | ||
|
||
export const title = 'Curatr activities with most comments (last 7 days)'; | ||
export const title = 'Stream activities with most comments (last 7 days)'; | ||
export const description = 'Activities with Most Comments - Last 7 Days'; | ||
export const image = LEADERBOARD_GREY_IMAGE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/TemplateCuratrCommentCount/constants.js → ...s/TemplateStreamCommentCount/constants.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { COUNTER_GREY_IMAGE } from 'ui/components/VisualiseIcon/assets'; | ||
|
||
export const title = 'Curatr comment count (last 7 days)'; | ||
export const title = 'Stream comment count (last 7 days)'; | ||
export const description = 'Comment Count - Last 7 vs Previous 7'; | ||
export const image = COUNTER_GREY_IMAGE; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.