Skip to content

Commit

Permalink
feat(orga): added columns in seeds and factory builders
Browse files Browse the repository at this point in the history
  • Loading branch information
alicegoarnisson committed Dec 18, 2024
1 parent e5572bb commit a451ffd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const buildKnowledgeElementSnapshot = function ({
userId,
snappedAt = new Date('2020-01-01'),
snapshot,
campaignParticipationId,
} = {}) {
const dateMinusOneDay = new Date(snappedAt.getTime() - 1000 * 60 * 60 * 24 * 7);
userId = _.isUndefined(userId) ? buildUser().id : userId;
Expand All @@ -24,6 +25,7 @@ const buildKnowledgeElementSnapshot = function ({
userId,
snappedAt,
snapshot,
campaignParticipationId,
};

return databaseBuffer.pushInsertable({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { databaseBuffer } from '../database-buffer.js';
import { buildKnowledgeElement } from './build-knowledge-element.js';

function buildSnapshot({ id, userId, snappedAt, knowledgeElementsAttributes }) {
function buildSnapshot({ id, userId, snappedAt, knowledgeElementsAttributes, campaignParticipationId }) {
const knowledgeElements = knowledgeElementsAttributes.map((attributes) => buildKnowledgeElement(attributes));

const values = {
id,
userId,
snappedAt,
snapshot: JSON.stringify(knowledgeElements),
campaignParticipationId,
};

return databaseBuffer.pushInsertable({
Expand Down
1 change: 1 addition & 0 deletions api/db/seeds/data/common/tooling/campaign-tooling.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ async function createAssessmentCampaign({
userId,
snappedAt: sharedAt,
snapshot: JSON.stringify(keDataForSnapshot),
campaignParticipationId,
});

if (configCampaign.recommendedTrainingsIds?.length > 0) {
Expand Down

0 comments on commit a451ffd

Please sign in to comment.