From 35dd4c15d44ec2ad9bb3dd5188e2d34c427be6e3 Mon Sep 17 00:00:00 2001 From: alisonmyers Date: Wed, 22 May 2024 14:46:53 -0700 Subject: [PATCH] fix merge issues --- index.js | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/index.js b/index.js index fb56341..c302847 100644 --- a/index.js +++ b/index.js @@ -3,13 +3,6 @@ const { flatten } = require('./util') const writeToCSV = require('./writeToCSV') require('dotenv').config(); -// Check for COURSE_IDS in environment variables -if (!process.env.COURSE_IDS) { - console.error('Error: COURSE_IDS environment variable is not defined.'); - process.exit(1); // Exit the script with a non-zero status -} -require('dotenv').config(); - // Check for COURSE_IDS in environment variables if (!process.env.COURSE_IDS) { console.error('Error: COURSE_IDS environment variable is not defined.'); @@ -37,13 +30,6 @@ const getNestedReplies = (replyObj, participants, topicId) => { postTimestamp: replyObj.created_at, postParentId: replyObj.parent_id || '', postId: replyObj.id - postAuthorId: replyObj.user_id, - postAuthorName: authorName, - postMessage: replyObj.message, - postLikes: replyObj.rating_sum || 0, - postTimestamp: replyObj.created_at, - postParentId: replyObj.parent_id || '', - postId: replyObj.id }, ...replies] } @@ -57,13 +43,11 @@ const getDiscussions = async courseId => { ])) ) return discussionAndTopic.map(([discussion, topic]) => { - const topicId = topic.id const topicId = topic.id const topicTitle = topic.title const topicMessage = topic.message const author = topic.author const topicCreatedAt = topic.created_at - const topicCreatedAt = topic.created_at const participants = discussion.participants const replies = discussion.view.length > 0 ? discussion.view @@ -73,22 +57,17 @@ const getDiscussions = async courseId => { return { - topicId, topicId, topicTitle, topicMessage, topicAuthorId: author.id || '', topicAuthorName: author.display_name || '', topicCreatedAt, - topicAuthorId: author.id || '', - topicAuthorName: author.display_name || '', - topicCreatedAt, replies } }) } -const courseIds = process.env.COURSE_IDS.split(',').map(id => id.trim()); const courseIds = process.env.COURSE_IDS.split(',').map(id => id.trim()); Promise.all(