@yrpri/api 9.0.139 → 9.0.140
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agents/assistants/agentAssistant.js +4 -3
- package/agents/assistants/baseAssistant.js +72 -71
- package/agents/assistants/baseAssistantWithVoice.js +6 -5
- package/agents/assistants/modes/agentDirectConnection.js +8 -7
- package/agents/assistants/modes/agentSelectionMode.js +2 -1
- package/agents/assistants/modes/baseAssistantMode.js +3 -2
- package/agents/assistants/modes/tools/agentTools.js +11 -10
- package/agents/assistants/modes/tools/loginTools.js +7 -6
- package/agents/assistants/modes/tools/models/agents.js +6 -5
- package/agents/assistants/modes/tools/models/subscriptions.js +7 -6
- package/agents/assistants/modes/tools/navigationTools.js +7 -6
- package/agents/assistants/modes/tools/subscriptionTools.js +12 -11
- package/agents/assistants/modes/tools/workflowConverstationTools.js +7 -6
- package/agents/assistants/voiceAssistant.js +45 -44
- package/agents/controllers/agentProductController.js +8 -7
- package/agents/controllers/agentSubscriptionController.js +13 -12
- package/agents/controllers/assistantsController.js +45 -44
- package/agents/controllers/policySynthAgents.js +33 -32
- package/agents/managers/emailInvitesManager.js +4 -3
- package/agents/managers/newAiModelSetup.js +45 -44
- package/agents/managers/notificationAgentQueueManager.js +55 -54
- package/agents/managers/subscriptionManager.js +24 -23
- package/agents/models/agentProduct.js +2 -1
- package/agents/models/agentProductBoosterPurchase.js +2 -1
- package/agents/models/testData/createEvolyAgentProduct.js +7 -6
- package/agents/models/testData/old/updateAgentWorkflowConfiguration.js +5 -4
- package/agents/models/testData/updateAgentWorkflowConfiguration.js +5 -4
- package/agents/tools/setTemplateWorkflowCommunityId.js +6 -5
- package/app.d.ts +2 -1
- package/app.js +60 -34
- package/authorization.cjs +4 -4
- package/controllers/allOurIdeas.js +45 -44
- package/controllers/groups.cjs +4 -9
- package/controllers/images.cjs +8 -8
- package/controllers/index.cjs +1 -1
- package/controllers/points.cjs +1 -1
- package/controllers/posts.cjs +3 -3
- package/deleteUnwantedDeclerations.cjs +5 -5
- package/models/community.cjs +1 -1
- package/models/domain.cjs +7 -7
- package/models/image.cjs +2 -2
- package/models/index.cjs +8 -4
- package/models/post.cjs +10 -10
- package/models/user.cjs +1 -1
- package/models/video.cjs +4 -4
- package/package.json +5 -5
- package/scripts/addRatingUsersToGroup.js +1 -1
- package/scripts/addUserToOrganization.js +8 -8
- package/scripts/agents/changeModelForWorkflowGroupTemplate.js +13 -12
- package/scripts/agents/generateAgentWorkflowTemplateFromAgentClass.js +5 -4
- package/scripts/analyseRatingsForCommunity.js +2 -2
- package/scripts/analyzeAndFixBrokenPointUsers.js +3 -3
- package/scripts/analyzeEndorsementsByCountry.js +7 -7
- package/scripts/analyzePostsForCommunity.js +1 -1
- package/scripts/bulkStatusUpdates/listUpdates.js +2 -2
- package/scripts/bulkStatusUpdates/mergeLatestPostsToUpdate.js +5 -5
- package/scripts/bulkStatusUpdates/performUpdate.js +9 -9
- package/scripts/bulkStatusUpdates/performUpdateForGroup.cjs +11 -11
- package/scripts/bulkStatusUpdates/performUpdateForStatus.js +15 -15
- package/scripts/change/changeVideoAspectTo.js +3 -3
- package/scripts/change/setUseNewVersion.cjs +4 -4
- package/scripts/changeCommunityGroupcount.js +3 -3
- package/scripts/changeCommunityPostCount.js +3 -3
- package/scripts/changeGroupPostCount.js +3 -3
- package/scripts/changeLanguage.js +4 -4
- package/scripts/changeOfficalStatus.js +3 -3
- package/scripts/cleanups/deleteAnonNotifications.cjs +7 -7
- package/scripts/cleanups/deleteLinkGroupsWithDeletedCommunities.js +8 -8
- package/scripts/cleanups/deleteYearOldNotifications.cjs +5 -5
- package/scripts/cleanups/removeAllUsersFromHiddenPublicGroup.js +5 -5
- package/scripts/clearAllEndorsementInGroup.js +5 -5
- package/scripts/cloning/clearUsersForCommunitiesFromUrl.js +3 -3
- package/scripts/cloning/cloneFromUrlScript.js +4 -4
- package/scripts/cloning/cloneWBFromUrlScriptAndCreateLinks.js +6 -6
- package/scripts/cloning/cloneWBFromUrlScriptNoUsersOrPoints.js +6 -6
- package/scripts/cloning/cloneWBSerbianFromUrlScriptAndCreateLinks.js +6 -6
- package/scripts/cloning/copyCommunityConfigAndTranslationsFromURL.js +3 -3
- package/scripts/cloning/copyCommunityOneGroupToDomainNoUsersNoEndorsements.js +2 -2
- package/scripts/cloning/copyCommunityToDomainNoUsersNoEndorsements.js +2 -2
- package/scripts/cloning/copyCommunityToDomainWithEverything.js +2 -2
- package/scripts/cloning/copyCommunityToDomainWithOnlyGroups.js +3 -3
- package/scripts/cloning/copyGroupConfigAndTranslationsFromURL.js +3 -3
- package/scripts/cloning/copyPostToGroupOld.js +12 -12
- package/scripts/cloning/copyPostVideosFromURL.js +3 -3
- package/scripts/cloning/copyPostWithOutAnyVotingOrActivities.js +2 -2
- package/scripts/cloning/deepCloneSerbianWBFromUrlScriptAndCreateLinks.js +7 -7
- package/scripts/cloning/deepCloneWBFromUrlScriptAndCreateLinks.js +6 -6
- package/scripts/cloning/setAdminsFromURL.js +5 -5
- package/scripts/cloning/setExternalIdsFromURL.js +3 -3
- package/scripts/countCommunity.js +11 -11
- package/scripts/countCommunityUsers.js +4 -4
- package/scripts/countDelayedNotifications.js +3 -3
- package/scripts/countGroup.js +11 -11
- package/scripts/countStuff.js +3 -3
- package/scripts/countUniqueVotersInAGroup.js +3 -3
- package/scripts/createInvitesAndShow.js +2 -2
- package/scripts/database/sync_database.js +2 -2
- package/scripts/database/sync_dev_database.js +3 -3
- package/scripts/debugNotifications.js +5 -5
- package/scripts/deleteAllNewsFeeds.js +2 -2
- package/scripts/deleteCategory.js +1 -1
- package/scripts/deleteOldAppActivities.js +5 -4
- package/scripts/deletePostContactDataForCommunity.js +5 -4
- package/scripts/destroy/destroy_all_but_one_domain.js +59 -59
- package/scripts/displayAuthorForPost.js +1 -1
- package/scripts/domains/createDomain.js +5 -4
- package/scripts/domains/importDomainsFromXls.js +7 -6
- package/scripts/endorsementFraudDetection/analyseEndorsementsForCommunity.js +2 -2
- package/scripts/endorsementFraudDetection/bulkDeleteDuplicateEndorsmentsFromUrl.js +9 -9
- package/scripts/exportAllStatusChanges.js +5 -5
- package/scripts/exportEndorsementsForCommunity.js +5 -5
- package/scripts/exportPointQualitiesForCommunity.js +5 -5
- package/scripts/exportPostsAndPointsForCommunity.js +9 -9
- package/scripts/exportPostsDataSetForDomain.js +12 -12
- package/scripts/exportPostsForGroup.js +7 -7
- package/scripts/exportRatingsForPost.js +2 -2
- package/scripts/exportUserEndorsementsWithUserAnalysis.js +6 -6
- package/scripts/exportUsersForCommunity.js +3 -3
- package/scripts/exportUsersForDomain.js +3 -3
- package/scripts/exportUsersForGroup.js +3 -3
- package/scripts/exports/ratingDistribution.js +6 -6
- package/scripts/exports/whoEndorsedWhatByCommunity.js +2 -2
- package/scripts/findUnusedClientImports.js +2 -2
- package/scripts/fixAllPostPointCounts.js +1 -1
- package/scripts/fixAnonNotificationsSettings.js +5 -5
- package/scripts/fixCountKopavogur.js +1 -1
- package/scripts/fixEndorsementsAfterCopyPostToGroup.js +10 -10
- package/scripts/fixExternalUserId.js +2 -2
- package/scripts/fixGroupAccess.js +3 -3
- package/scripts/fixGroupIdeasAndPointsCount.js +2 -2
- package/scripts/fixNotificationSettings.js +4 -4
- package/scripts/fixSurveyRadioBakedInSubCodes.js +6 -6
- package/scripts/fixWrongUserIdForStatusUpdates.js +6 -5
- package/scripts/gallery/exportGalleryData.js +2 -2
- package/scripts/gallery/importGalleryForCommunity.js +14 -14
- package/scripts/gallery/readJsonAndDownloadImagesVersion2.js +6 -6
- package/scripts/gallery/refreshAcApiPostIdsForCommunity.js +5 -5
- package/scripts/genderAnalysis.js +10 -10
- package/scripts/genderAnalysisByStatus.js +4 -4
- package/scripts/importAllLocalesFromLocalFolders.js +7 -7
- package/scripts/importDomain.js +131 -131
- package/scripts/keys/addOidcToDomain.cjs +9 -9
- package/scripts/landUseGame/export3Ddata.js +15 -15
- package/scripts/listLanguagesForGroup.js +6 -6
- package/scripts/loadTestCreateDummyContentForGroup.js +2 -2
- package/scripts/makeRecursiveMapData.js +4 -4
- package/scripts/mapping/community_map_csv.js +5 -5
- package/scripts/moveCommunityToDomain.js +3 -3
- package/scripts/moveGroupToCommunity.js +3 -3
- package/scripts/movePostToGroup.js +5 -5
- package/scripts/movePostsToGroupsRecountGroupFromUrl.js +6 -6
- package/scripts/oldMovePostToGroup.js +9 -9
- package/scripts/processCsvForPdfUrls.js +2 -2
- package/scripts/processCsvForTranslationAndToxicity.js +10 -10
- package/scripts/recount/recount_recursive_communities.js +6 -6
- package/scripts/recountALLCommunityGroupCounts.js +4 -4
- package/scripts/recountAll.js +3 -3
- package/scripts/recountCommunitesFromUrl.js +3 -3
- package/scripts/recountCommunity.js +2 -2
- package/scripts/recountGroup.js +5 -5
- package/scripts/recountGroupNoUserChange.js +5 -5
- package/scripts/resetAllEndorsementsForGroup.js +3 -3
- package/scripts/resetEnTranslationForGroup.js +5 -5
- package/scripts/setAdminOnAll.cjs +14 -14
- package/scripts/setDomainAdmin.cjs +6 -6
- package/scripts/setDomainLocales.js +2 -2
- package/scripts/setEarlQuestionIdOnGroup.cjs +4 -4
- package/scripts/setLanguageOnGroupCommunitesFromUrl.js +3 -3
- package/scripts/setMemberOfAll.js +14 -14
- package/scripts/setNewUserForContentOfCommunity.js +9 -9
- package/scripts/setOfficialStatusOnAllPostsForCommunity.js +1 -1
- package/scripts/setUserOnAll.js +14 -14
- package/scripts/showCategoryForGroup.js +1 -1
- package/scripts/showOldActivityTypes.js +3 -3
- package/scripts/showPostsMissingCategoryForGroup.js +2 -2
- package/scripts/showStatuses.js +4 -4
- package/scripts/showUniqueVotersInCommunity.js +4 -4
- package/scripts/showUserAgentsAndIpsForEmails.js +4 -4
- package/scripts/simpleExportForGroupsForCommunity.js +5 -5
- package/scripts/simpleExportForPointsForCommunity.js +5 -5
- package/scripts/simpleExportForPostsForCommunity.js +5 -5
- package/scripts/testForEndorsments.js +4 -4
- package/scripts/undeleteGroupAndAllContent.js +8 -8
- package/scripts/undeletePost.js +7 -7
- package/scripts/unlinkSsn.js +4 -4
- package/scripts/updateFromAlthingi.js +8 -8
- package/scripts/users/createUserAddDomain.js +6 -5
- package/scripts/users/importUsersForDomainsFromXls.js +4 -3
- package/scripts/users/listDomainUsersWithSsn.js +6 -5
- package/scripts/users/removeUserFromDomain.js +6 -5
- package/scripts/users/updatePasswordFromSsn.js +5 -4
- package/scripts/users/updateUserSsnFromEmail.js +5 -4
- package/services/controllers/activities.cjs +1 -1
- package/services/controllers/news_feeds.cjs +1 -1
- package/services/controllers/notifications.cjs +1 -1
- package/services/controllers/recommendations.cjs +1 -1
- package/services/engine/allOurIdeas/aiHelper.js +10 -9
- package/services/engine/analytics/export_anon_community_activities.js +3 -3
- package/services/engine/analytics/importer.js +10 -10
- package/services/engine/analytics/plausible/manager.cjs +4 -4
- package/services/engine/analytics/statsCalc.cjs +1 -1
- package/services/engine/analytics/utils.cjs +10 -10
- package/services/engine/moderation/fraud/CreateFraudAuditReport.cjs +2 -1
- package/services/engine/moderation/fraud/FraudBase.cjs +2 -2
- package/services/engine/moderation/fraud/FraudDeleteBase.cjs +4 -4
- package/services/engine/moderation/fraud/FraudGetBase.cjs +1 -1
- package/services/engine/moderation/fraud/FraudGetEndorsements.cjs +1 -1
- package/services/engine/moderation/fraud/FraudGetPointQualities.cjs +1 -1
- package/services/engine/moderation/fraud/FraudGetPoints.cjs +1 -1
- package/services/engine/moderation/fraud/FraudGetPosts.cjs +1 -1
- package/services/engine/moderation/fraud/FraudGetRatings.cjs +1 -1
- package/services/engine/moderation/fraud/FraudScannerNotifier.cjs +9 -9
- package/services/engine/moderation/get_moderation_items.cjs +1 -1
- package/services/engine/moderation/image_labeling/ImageLabelingBase.cjs +1 -1
- package/services/engine/moderation/process_moderation_items.cjs +1 -1
- package/services/engine/moderation/toxicity_analysis.cjs +1 -1
- package/services/engine/news_feeds/generate_dynamically.cjs +1 -1
- package/services/engine/news_feeds/generate_from_notifications.cjs +1 -1
- package/services/engine/notifications/emails_utils.cjs +2 -2
- package/services/engine/notifications/generate_point_notifications.cjs +1 -1
- package/services/engine/notifications/generate_post_notifications.cjs +1 -1
- package/services/engine/notifications/process_delayed_notifications.cjs +38 -38
- package/services/engine/old/exporters/categories_dataset.js +11 -11
- package/services/engine/old/exporters/sentiment_dataset.js +12 -12
- package/services/engine/recommendations/events_importer.cjs +5 -5
- package/services/engine/recommendations/events_manager.cjs +1 -1
- package/services/engine/reports/add_points_to_sheet.cjs +2 -2
- package/services/engine/reports/commonUtils.js +3 -2
- package/services/engine/reports/common_utils.cjs +8 -8
- package/services/engine/reports/docx_group_report.cjs +1 -1
- package/services/engine/reports/xlsAllOurIdeasExport.js +16 -15
- package/services/engine/reports/xls_community_users_report.cjs +2 -2
- package/services/engine/reports/xls_group_report.cjs +1 -1
- package/services/llms/baseChatBot.js +12 -11
- package/services/llms/imageGeneration/chatGptImageGenerator.js +3 -2
- package/services/llms/imageGeneration/collectionImageGenerator.js +7 -6
- package/services/llms/imageGeneration/dalleImageGenerator.js +6 -5
- package/services/llms/imageGeneration/fluxImageGenerator.js +5 -4
- package/services/llms/imageGeneration/imageProcessorService.js +2 -1
- package/services/llms/imageGeneration/imagenImageGenerator.js +8 -7
- package/services/llms/imageGeneration/s3Service.js +12 -11
- package/services/llms/llmTranslation.js +30 -29
- package/services/models/ac_activity.cjs +1 -1
- package/services/models/ac_notification.cjs +1 -1
- package/services/models/ac_translation_cache.cjs +11 -11
- package/services/scripts/analytics/setup_all_plausible_goals.cjs +2 -2
- package/services/scripts/fix_old_delayed_notifications.js +3 -3
- package/services/scripts/kue_status.js +11 -11
- package/services/scripts/kue_watch_stuck_jobs.js +6 -6
- package/services/scripts/translation_clear_language.js +21 -21
- package/services/scripts/translation_delete.js +4 -4
- package/services/scripts/translation_replace_text_from_url.js +4 -4
- package/services/scripts/translation_update.js +4 -4
- package/services/scripts/translations_list.js +5 -5
- package/services/utils/airbrake.cjs +2 -1
- package/services/utils/redisConnection.cjs +6 -5
- package/services/utils/translation_helpers.cjs +3 -2
- package/services/utils/updateAllLocalesFromEn.js +20 -19
- package/services/utils/updateLocaleFolders.js +7 -6
- package/services/workers/activity.cjs +1 -1
- package/services/workers/anonymizations.cjs +1 -1
- package/services/workers/bulk_status_update.cjs +2 -2
- package/services/workers/delayed_jobs.cjs +1 -1
- package/services/workers/deletions.cjs +1 -1
- package/services/workers/email.cjs +1 -1
- package/services/workers/fraud_management.cjs +3 -3
- package/services/workers/generativeAi.js +6 -5
- package/services/workers/main.cjs +1 -1
- package/services/workers/marketing.cjs +1 -1
- package/services/workers/moderation.cjs +1 -1
- package/services/workers/notification_delivery.cjs +1 -1
- package/services/workers/notification_news_feed.cjs +1 -1
- package/services/workers/queue.cjs +2 -2
- package/services/workers/recount.cjs +1 -1
- package/services/workers/reports.cjs +1 -1
- package/services/workers/similarities.cjs +4 -2
- package/services/workers/speech_to_text.cjs +1 -1
- package/utils/airbrake.cjs +1 -1
- package/utils/cjsCodeReview.js +7 -6
- package/utils/community_mapping_tools.cjs +2 -2
- package/utils/copy_utils.cjs +31 -31
- package/utils/export_utils.cjs +7 -7
- package/utils/generateDocumentation.js +10 -9
- package/utils/logger.cjs +2 -23
- package/utils/logger.d.cts +1 -1
- package/utils/loggerAirbrakeTransport.cjs +52 -0
- package/utils/loggerAirbrakeTransport.d.cts +15 -0
- package/utils/loggerAirbrakeTransportTs.d.ts +15 -0
- package/utils/loggerAirbrakeTransportTs.js +45 -0
- package/utils/loggerCore.cjs +29 -0
- package/utils/loggerCore.d.cts +2 -0
- package/utils/loggerCoreTs.d.ts +2 -0
- package/utils/loggerCoreTs.js +23 -0
- package/utils/loggerTs.d.ts +1 -2
- package/utils/loggerTs.js +2 -25
- package/utils/recount_utils.cjs +5 -5
- package/utils/seedModels.js +50 -49
- package/utils/sitemap_generator.cjs +4 -4
- package/utils/ypLanguages.js +2 -2
- package/webSockets.js +8 -7
- package/services/utils/logger.cjs +0 -25
- package/services/utils/logger.d.cts +0 -2
- package/src/agents/assistants/assistant.d.ts +0 -156
- package/src/controllers/audios.d.ts +0 -5
- package/src/controllers/categories.d.ts +0 -5
- package/src/controllers/communities.d.ts +0 -5
- package/src/controllers/domains.d.ts +0 -5
- package/src/controllers/groups.d.ts +0 -5
- package/src/controllers/images.d.ts +0 -5
- package/src/controllers/points.d.ts +0 -5
- package/src/controllers/posts.d.ts +0 -5
- package/src/controllers/ratings.d.ts +0 -5
- package/src/controllers/users.d.ts +0 -5
- package/src/controllers/videos.d.ts +0 -5
- package/src/models/index.d.ts +0 -84
- package/src/services/controllers/activities.d.ts +0 -5
- package/src/services/controllers/notifications.d.ts +0 -5
- package/src/utils/copy_utils.d.ts +0 -4
- package/src/utils/manifest_generator.d.ts +0 -18
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var models = require('../../../models/index.cjs');
|
|
3
3
|
var async = require('async');
|
|
4
|
-
var log = require('
|
|
4
|
+
var log = require('../../../utils/logger.cjs');
|
|
5
5
|
var _ = require('lodash');
|
|
6
6
|
var moment = require('moment');
|
|
7
7
|
var i18n = require('../../utils/i18n.cjs');
|
|
8
8
|
var Backend = require('i18next-fs-backend');
|
|
9
9
|
var sendOneEmail = require('./emails_utils.cjs').sendOneEmail;
|
|
10
10
|
var sendPostNew = function (delayedNotification, callback) {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
log.info("sendPostNew");
|
|
12
|
+
log.info("User email: " + delayedNotification.User.email);
|
|
13
13
|
async.forEach(delayedNotification.AcNotifications, function (notification, seriesCallback) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
log.info("Type: " + notification.AcActivities[0].type);
|
|
15
|
+
log.info("Post name: " + notification.AcActivities[0].Post.name);
|
|
16
|
+
log.info("Domain name: " + notification.AcActivities[0].Domain.name);
|
|
17
|
+
log.info("User name: " + notification.AcActivities[0].User.name);
|
|
18
18
|
seriesCallback();
|
|
19
19
|
}, function (error) {
|
|
20
20
|
callback();
|
|
21
21
|
});
|
|
22
22
|
};
|
|
23
23
|
var sendPostEndorsement = function (delayedNotification, callback) {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
log.info("sendPostEndorsement");
|
|
25
|
+
log.info("User email: " + delayedNotification.User.email);
|
|
26
26
|
async.forEach(delayedNotification.AcNotifications, function (notification, seriesCallback) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
log.info("Type: " + notification.AcActivities[0].type);
|
|
28
|
+
log.info("Post name: " + notification.AcActivities[0].Post.name);
|
|
29
|
+
log.info("Domain name: " + notification.AcActivities[0].Domain.name);
|
|
30
|
+
log.info("User name: " + notification.AcActivities[0].User.name);
|
|
31
31
|
seriesCallback();
|
|
32
32
|
}, function (error) {
|
|
33
33
|
callback();
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
36
|
var sendPointNew = function (delayedNotification, callback) {
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
log.info("sendPointNew");
|
|
38
|
+
log.info("User email: " + delayedNotification.User.email);
|
|
39
39
|
async.forEach(delayedNotification.AcNotifications, function (notification, seriesCallback) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
log.info("Type: " + notification.AcActivities[0].type);
|
|
41
|
+
log.info("Post name: " + notification.AcActivities[0].Post.name);
|
|
42
|
+
log.info("Domain name: " + notification.AcActivities[0].Domain.name);
|
|
43
|
+
log.info("User name: " + notification.AcActivities[0].User.name);
|
|
44
44
|
seriesCallback();
|
|
45
45
|
}, function (error) {
|
|
46
46
|
callback();
|
|
@@ -198,7 +198,7 @@ var processNewNewsStories = function (email, groupItems) {
|
|
|
198
198
|
});
|
|
199
199
|
};
|
|
200
200
|
var sendNotificationEmail = function (delayedNotification, callback) {
|
|
201
|
-
|
|
201
|
+
log.info("sendNotificationEmail User email: " + delayedNotification.User.email);
|
|
202
202
|
var emailUser = delayedNotification.User;
|
|
203
203
|
var notifications = [];
|
|
204
204
|
var email;
|
|
@@ -287,7 +287,7 @@ var sendNotificationEmail = function (delayedNotification, callback) {
|
|
|
287
287
|
seriesCallback();
|
|
288
288
|
}
|
|
289
289
|
else {
|
|
290
|
-
|
|
290
|
+
log.error("No notification");
|
|
291
291
|
seriesCallback();
|
|
292
292
|
}
|
|
293
293
|
}).catch(function (error) {
|
|
@@ -338,32 +338,32 @@ var sendNotificationEmail = function (delayedNotification, callback) {
|
|
|
338
338
|
});
|
|
339
339
|
}
|
|
340
340
|
else {
|
|
341
|
-
|
|
341
|
+
log.error("No items");
|
|
342
342
|
callback();
|
|
343
343
|
}
|
|
344
344
|
});
|
|
345
345
|
};
|
|
346
346
|
var sendPointNewsStory = function (delayedNotification, callback) {
|
|
347
|
-
|
|
348
|
-
|
|
347
|
+
log.info("sendPointNewsStory");
|
|
348
|
+
log.info("User email: " + delayedNotification.User.email);
|
|
349
349
|
async.forEach(delayedNotification.AcNotifications, function (notification, seriesCallback) {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
350
|
+
log.info("Type: " + notification.AcActivities[0].type);
|
|
351
|
+
log.info("Post name: " + notification.AcActivities[0].Post.name);
|
|
352
|
+
log.info("Domain name: " + notification.AcActivities[0].Domain.name);
|
|
353
|
+
log.info("User name: " + notification.AcActivities[0].User.name);
|
|
354
354
|
seriesCallback();
|
|
355
355
|
}, function (error) {
|
|
356
356
|
callback();
|
|
357
357
|
});
|
|
358
358
|
};
|
|
359
359
|
var sendPointComment = function (delayedNotification, callback) {
|
|
360
|
-
|
|
361
|
-
|
|
360
|
+
log.info("sendPointComment");
|
|
361
|
+
log.info("User email: " + delayedNotification.User.email);
|
|
362
362
|
async.forEach(delayedNotification.AcNotifications, function (notification, seriesCallback) {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
363
|
+
log.info("Type: " + notification.AcActivities[0].type);
|
|
364
|
+
log.info("Post name: " + notification.AcActivities[0].Post.name);
|
|
365
|
+
log.info("Domain name: " + notification.AcActivities[0].Domain.name);
|
|
366
|
+
log.info("User name: " + notification.AcActivities[0].User.name);
|
|
367
367
|
seriesCallback();
|
|
368
368
|
}, function (error) {
|
|
369
369
|
callback();
|
|
@@ -397,19 +397,19 @@ var sendNotification = function (notification, callback) {
|
|
|
397
397
|
var getDelayedNotificationToProcess = function (frequency, callback) {
|
|
398
398
|
var beforeDate;
|
|
399
399
|
if (frequency == 1) {
|
|
400
|
-
|
|
400
|
+
log.info("Processing hourly");
|
|
401
401
|
beforeDate = { name: "date", after: moment().add(-1, 'hours').toDate() };
|
|
402
402
|
}
|
|
403
403
|
else if (frequency == 2) {
|
|
404
|
-
|
|
404
|
+
log.info("Processing daily");
|
|
405
405
|
beforeDate = { name: "date", after: moment().add(-1, 'days').toDate() };
|
|
406
406
|
}
|
|
407
407
|
else if (frequency == 3) {
|
|
408
|
-
|
|
408
|
+
log.info("Processing weekly");
|
|
409
409
|
beforeDate = { name: "date", after: moment().add(-7, 'days').toDate() };
|
|
410
410
|
}
|
|
411
411
|
else if (frequency == 4) {
|
|
412
|
-
|
|
412
|
+
log.info("Processing monthly");
|
|
413
413
|
beforeDate = { name: "date", after: moment().add(-1, 'months').toDate() };
|
|
414
414
|
}
|
|
415
415
|
if (beforeDate) {
|
|
@@ -48,7 +48,7 @@ async.series([
|
|
|
48
48
|
}
|
|
49
49
|
]
|
|
50
50
|
}).then(function (posts) {
|
|
51
|
-
|
|
51
|
+
log.info('Found ' + posts.length + " posts");
|
|
52
52
|
async.eachSeries(posts, function (post, seriesCallback) {
|
|
53
53
|
var newId = replaceBetterReykjavikCategoryId(post.category_id);
|
|
54
54
|
if (newId && newId != 11) {
|
|
@@ -67,7 +67,7 @@ async.series([
|
|
|
67
67
|
categories[newId].push(content);
|
|
68
68
|
}
|
|
69
69
|
async.eachSeries(post.Points, function (point, innerSeriesCallback) {
|
|
70
|
-
|
|
70
|
+
log.info(point.status);
|
|
71
71
|
if (point.value != 0) {
|
|
72
72
|
content = '"' + clean(point.content) + '"';
|
|
73
73
|
if (content != "" && content.length > 17) {
|
|
@@ -87,15 +87,15 @@ async.series([
|
|
|
87
87
|
}
|
|
88
88
|
}, function () {
|
|
89
89
|
async.eachSeries(categoriesIds, function (category_id, seriesCallback) {
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
log.info(category_id);
|
|
91
|
+
log.info("-----" + category_id + "---------------------------: " + categories[category_id].length);
|
|
92
92
|
if (categories[category_id].length > MAX_CATEGORY_LENGTH) {
|
|
93
93
|
categories[category_id] = categories[category_id].splice(0, MAX_CATEGORY_LENGTH);
|
|
94
|
-
|
|
94
|
+
log.info("-----" + category_id + "---------------------------: " + categories[category_id].length);
|
|
95
95
|
}
|
|
96
96
|
async.eachSeries(categories[category_id], function (post, innerSeriesCallback) {
|
|
97
97
|
categoriesCsvRows.push(category_id + ',' + post);
|
|
98
|
-
|
|
98
|
+
log.info("Key: " + category_id + " value: " + post);
|
|
99
99
|
innerSeriesCallback();
|
|
100
100
|
}, function () {
|
|
101
101
|
seriesCallback();
|
|
@@ -107,13 +107,13 @@ async.series([
|
|
|
107
107
|
});
|
|
108
108
|
});
|
|
109
109
|
}).catch(function (error) {
|
|
110
|
-
|
|
110
|
+
log.info("ERROR: " + error);
|
|
111
111
|
});
|
|
112
112
|
},
|
|
113
113
|
function (callback) {
|
|
114
114
|
fs.writeFile(trainCategoriesCsvFilename, trainCategoriesCsv.join('\n'), function (err) {
|
|
115
115
|
if (err) {
|
|
116
|
-
|
|
116
|
+
log.info(err);
|
|
117
117
|
}
|
|
118
118
|
callback();
|
|
119
119
|
});
|
|
@@ -121,7 +121,7 @@ async.series([
|
|
|
121
121
|
function (callback) {
|
|
122
122
|
fs.writeFile(testCategoriesCsvFilename, testCategoriesCsv.join('\n'), function (err) {
|
|
123
123
|
if (err) {
|
|
124
|
-
|
|
124
|
+
log.info(err);
|
|
125
125
|
}
|
|
126
126
|
callback();
|
|
127
127
|
});
|
|
@@ -142,12 +142,12 @@ async.series([
|
|
|
142
142
|
function (callback) {
|
|
143
143
|
fs.writeFile(classesCategoriesCsvFilename, classesCategoriesCsv.join('\n'), function (err) {
|
|
144
144
|
if (err) {
|
|
145
|
-
|
|
145
|
+
log.info(err);
|
|
146
146
|
}
|
|
147
147
|
callback();
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
150
|
], function (error) {
|
|
151
|
-
|
|
151
|
+
log.info("FINISHED :)");
|
|
152
152
|
});
|
|
153
153
|
export {};
|
|
@@ -57,7 +57,7 @@ async.series([
|
|
|
57
57
|
}
|
|
58
58
|
]
|
|
59
59
|
}).then(function (posts) {
|
|
60
|
-
|
|
60
|
+
log.info('Found ' + posts.length + " posts");
|
|
61
61
|
async.eachSeries(posts, function (post, seriesCallback) {
|
|
62
62
|
async.eachSeries(post.Points, function (point, innerSeriesCallback) {
|
|
63
63
|
if (point.value != 0) {
|
|
@@ -82,15 +82,15 @@ async.series([
|
|
|
82
82
|
});
|
|
83
83
|
}, function () {
|
|
84
84
|
async.eachSeries(categoriesIds, function (category_id, seriesCallback) {
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
log.info(category_id);
|
|
86
|
+
log.info("-----" + category_id + "---------------------------: " + categories[category_id].length);
|
|
87
87
|
if (categories[category_id].length > MAX_SENTIMENT_LENGTH) {
|
|
88
88
|
categories[category_id] = categories[category_id].splice(0, MAX_SENTIMENT_LENGTH);
|
|
89
|
-
|
|
89
|
+
log.info("-----" + category_id + "---------------------------: " + categories[category_id].length);
|
|
90
90
|
}
|
|
91
91
|
async.eachSeries(categories[category_id], function (post, innerSeriesCallback) {
|
|
92
92
|
categoriesCsvRows.push(category_id + ',' + post);
|
|
93
|
-
|
|
93
|
+
log.info("Key: " + category_id + " value: " + post);
|
|
94
94
|
innerSeriesCallback();
|
|
95
95
|
}, function () {
|
|
96
96
|
seriesCallback();
|
|
@@ -102,13 +102,13 @@ async.series([
|
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
104
|
}).catch(function (error) {
|
|
105
|
-
|
|
105
|
+
log.info("ERROR: " + error);
|
|
106
106
|
});
|
|
107
107
|
},
|
|
108
108
|
function (callback) {
|
|
109
109
|
fs.writeFile(trainCsvFilename, trainCategoriesCsv.join('\n'), function (err) {
|
|
110
110
|
if (err) {
|
|
111
|
-
|
|
111
|
+
log.info(err);
|
|
112
112
|
}
|
|
113
113
|
callback();
|
|
114
114
|
});
|
|
@@ -116,7 +116,7 @@ async.series([
|
|
|
116
116
|
function (callback) {
|
|
117
117
|
fs.writeFile(testTrainCsvFilename, testCategoriesCsv.join('\n'), function (err) {
|
|
118
118
|
if (err) {
|
|
119
|
-
|
|
119
|
+
log.info(err);
|
|
120
120
|
}
|
|
121
121
|
callback();
|
|
122
122
|
});
|
|
@@ -125,7 +125,7 @@ async.series([
|
|
|
125
125
|
negative = positive.splice(0, MAX_SENTIMENT_LENGTH);
|
|
126
126
|
fs.writeFile(classesTrainPositiveCsvFilename, positive.join('\n'), function (err) {
|
|
127
127
|
if (err) {
|
|
128
|
-
|
|
128
|
+
log.info(err);
|
|
129
129
|
}
|
|
130
130
|
callback();
|
|
131
131
|
});
|
|
@@ -134,7 +134,7 @@ async.series([
|
|
|
134
134
|
negative = negative.splice(0, MAX_SENTIMENT_LENGTH);
|
|
135
135
|
fs.writeFile(classesTrainNegativeCsvFilename, negative.join('\n'), function (err) {
|
|
136
136
|
if (err) {
|
|
137
|
-
|
|
137
|
+
log.info(err);
|
|
138
138
|
}
|
|
139
139
|
callback();
|
|
140
140
|
});
|
|
@@ -146,12 +146,12 @@ async.series([
|
|
|
146
146
|
function (callback) {
|
|
147
147
|
fs.writeFile(classesTrainCsvFilename, classesCategoriesCsv.join('\n'), function (err) {
|
|
148
148
|
if (err) {
|
|
149
|
-
|
|
149
|
+
log.info(err);
|
|
150
150
|
}
|
|
151
151
|
callback();
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
154
|
], function (error) {
|
|
155
|
-
|
|
155
|
+
log.info("FINISHED :)");
|
|
156
156
|
});
|
|
157
157
|
export {};
|
|
@@ -65,7 +65,7 @@ const importAllActionsFor = function (model, where, include, action, done, attri
|
|
|
65
65
|
seriesCallback();
|
|
66
66
|
}
|
|
67
67
|
else {
|
|
68
|
-
|
|
68
|
+
log.error("Can't find id for object: " + object);
|
|
69
69
|
seriesCallback();
|
|
70
70
|
}
|
|
71
71
|
}, error => {
|
|
@@ -77,8 +77,8 @@ const importAllActionsFor = function (model, where, include, action, done, attri
|
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
}, function (error) {
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
log.info(error);
|
|
81
|
+
log.info("\n FIN");
|
|
82
82
|
done();
|
|
83
83
|
});
|
|
84
84
|
});
|
|
@@ -129,11 +129,11 @@ var importAll = function (done) {
|
|
|
129
129
|
}, ['id', 'user_id', 'created_at', 'value', 'ip_address', 'user_agent']);
|
|
130
130
|
}
|
|
131
131
|
], function () {
|
|
132
|
-
|
|
132
|
+
log.info("FIN");
|
|
133
133
|
done();
|
|
134
134
|
});
|
|
135
135
|
};
|
|
136
136
|
importAll(function () {
|
|
137
|
-
|
|
137
|
+
log.info("Done importing all");
|
|
138
138
|
process.exit();
|
|
139
139
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const models = require('../../../models/index.cjs');
|
|
3
3
|
const _ = require('lodash');
|
|
4
4
|
const async = require('async');
|
|
5
|
-
const log = require('
|
|
5
|
+
const log = require('../../../utils/logger.cjs');
|
|
6
6
|
const request = require('request');
|
|
7
7
|
let airbrake = null;
|
|
8
8
|
if (process.env.AIRBRAKE_PROJECT_ID) {
|
|
@@ -37,7 +37,7 @@ const getPointTextWithEverything = (group, post, point) => {
|
|
|
37
37
|
return outText.trim();
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
|
-
|
|
40
|
+
log.error("getPointTextWithEverything: missing data", group, post, point);
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
const getPointValueText = (value) => {
|
|
@@ -74,7 +74,7 @@ const addPostPointsToSheet = (worksheet, post, group) => {
|
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
else {
|
|
77
|
-
|
|
77
|
+
log.error("addPostPointsToSheet: missing data", worksheet, post, group);
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
80
|
};
|
|
@@ -4,6 +4,7 @@ import fs from "fs";
|
|
|
4
4
|
import stream from "stream";
|
|
5
5
|
import { promisify } from "util";
|
|
6
6
|
import models from "../../../models/index.cjs";
|
|
7
|
+
import log from "../../../utils/loggerTs.js";
|
|
7
8
|
const dbModels = models;
|
|
8
9
|
const AcBackgroundJob = dbModels.AcBackgroundJob;
|
|
9
10
|
export const updateUploadJobStatus = async (jobId, uploadProgress, data = undefined) => {
|
|
@@ -17,11 +18,11 @@ export const updateUploadJobStatus = async (jobId, uploadProgress, data = undefi
|
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
catch (error) {
|
|
20
|
-
|
|
21
|
+
log.error("updateUploadJobStatus", { error: error });
|
|
21
22
|
}
|
|
22
23
|
};
|
|
23
24
|
export const setJobError = async (jobId, errorToUser, errorDetail = undefined) => {
|
|
24
|
-
|
|
25
|
+
log.error("Error in background job", { error: errorDetail });
|
|
25
26
|
try {
|
|
26
27
|
await AcBackgroundJob.update({ error: errorToUser, progress: 0 }, { where: { id: jobId } });
|
|
27
28
|
}
|
|
@@ -5,7 +5,7 @@ var _ = require('lodash');
|
|
|
5
5
|
const moment = require('moment');
|
|
6
6
|
const skipEmail = false;
|
|
7
7
|
const aws = require('aws-sdk');
|
|
8
|
-
const log = require('
|
|
8
|
+
const log = require('../../../utils/logger.cjs');
|
|
9
9
|
const request = require('request');
|
|
10
10
|
const fs = require('fs');
|
|
11
11
|
const downloadImage = (uri, filename, callback) => {
|
|
@@ -71,7 +71,7 @@ const updateJobStatusIfNeeded = (jobId, totalPosts, processedCount, lastReported
|
|
|
71
71
|
models.AcBackgroundJob.update({ progress }, { where: { id: jobId } }).then(() => {
|
|
72
72
|
done(null, true);
|
|
73
73
|
}).catch((error) => {
|
|
74
|
-
|
|
74
|
+
log.info("Error updating job status", { error: error });
|
|
75
75
|
done(error);
|
|
76
76
|
});
|
|
77
77
|
}
|
|
@@ -263,15 +263,15 @@ const getUserEmail = function (post) {
|
|
|
263
263
|
}
|
|
264
264
|
};
|
|
265
265
|
const clean = function (text) {
|
|
266
|
-
//
|
|
266
|
+
//log.info("Before: "+ text);
|
|
267
267
|
var newText = text.replace('"', "'").replace('\n', '').replace('\r', '').replace(/(\r\n|\n|\r)/gm, "").replace(/"/gm, "'").replace(/,/, ';').trim();
|
|
268
|
-
//
|
|
268
|
+
//log.info("After:" + newText);
|
|
269
269
|
return newText.replace(/´/g, '');
|
|
270
270
|
};
|
|
271
271
|
const cleanDescription = function (text) {
|
|
272
|
-
//
|
|
272
|
+
//log.info("Before: "+ text);
|
|
273
273
|
var newText = text.replace('"', "'").replace(/"/gm, "'").replace(/,/, ';').trim();
|
|
274
|
-
//
|
|
274
|
+
//log.info("After:" + newText);
|
|
275
275
|
return newText.replace(/´/g, '');
|
|
276
276
|
};
|
|
277
277
|
const getLocation = function (post) {
|
|
@@ -290,7 +290,7 @@ const getPoints = function (points) {
|
|
|
290
290
|
if (content.startsWith(",")) {
|
|
291
291
|
content = content.substr(1);
|
|
292
292
|
}
|
|
293
|
-
//
|
|
293
|
+
//log.info("content: "+content);
|
|
294
294
|
totalContent += content;
|
|
295
295
|
});
|
|
296
296
|
return totalContent;
|
|
@@ -589,7 +589,7 @@ var getExportFileDataForGroup = function (group, hostName, callback) {
|
|
|
589
589
|
if (group.configuration && group.configuration.customRatings) {
|
|
590
590
|
customRatings = group.configuration.customRatings;
|
|
591
591
|
}
|
|
592
|
-
//
|
|
592
|
+
//log.info(posts.length);
|
|
593
593
|
outFileContent += "Nr, Post id,email,User Name,Post Name," + getDescriptionHeaders(group) + ",Url,Category,Latitude,Longitude,Up Votes,Down Votes,Points Count,Points For,Points Against,Images,Contact Name,Contact Email,Contact telephone,Attachment URL,Attachment filename,Media URLs,Post transcript" + getRatingHeaders(customRatings) + "\n";
|
|
594
594
|
let postCounter = 0;
|
|
595
595
|
async.eachSeries(posts, function (post, seriesCallback) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const models = require("../../../models/index.cjs");
|
|
3
3
|
const async = require("async");
|
|
4
4
|
const moment = require("moment");
|
|
5
|
-
const log = require("
|
|
5
|
+
const log = require("../../../utils/logger.cjs");
|
|
6
6
|
const _ = require("lodash");
|
|
7
7
|
const docx = require("docx");
|
|
8
8
|
const fs = require("fs");
|
|
@@ -4,6 +4,7 @@ import { Headers } from "node-fetch";
|
|
|
4
4
|
import { v4 as uuidv4 } from "uuid";
|
|
5
5
|
import models from "../../../models/index.cjs";
|
|
6
6
|
import { setJobError, updateUploadJobStatus, uploadToS3, } from "./commonUtils.js";
|
|
7
|
+
import log from "../../../utils/loggerTs.js";
|
|
7
8
|
const dbModels = models;
|
|
8
9
|
const Image = dbModels.Image;
|
|
9
10
|
const PAIRWISE_API_HOST = process.env.PAIRWISE_API_HOST; // Your API host
|
|
@@ -18,16 +19,16 @@ async function fetchChoices(questionId, utmSource) {
|
|
|
18
19
|
method: "GET",
|
|
19
20
|
headers: defaultAuthHeader,
|
|
20
21
|
});
|
|
21
|
-
|
|
22
|
+
log.info(url);
|
|
22
23
|
if (!response.ok) {
|
|
23
|
-
|
|
24
|
+
log.error(response.statusText);
|
|
24
25
|
throw new Error("Fetching choices failed.");
|
|
25
26
|
}
|
|
26
27
|
const choices = (await response.json());
|
|
27
28
|
return choices;
|
|
28
29
|
}
|
|
29
30
|
catch (error) {
|
|
30
|
-
|
|
31
|
+
log.error("Error fetching choices:", error);
|
|
31
32
|
throw error;
|
|
32
33
|
}
|
|
33
34
|
}
|
|
@@ -42,14 +43,14 @@ async function fetchVotes(questionId, choiceId, utmSource) {
|
|
|
42
43
|
headers: defaultAuthHeader,
|
|
43
44
|
});
|
|
44
45
|
if (!response.ok) {
|
|
45
|
-
|
|
46
|
+
log.error(response.statusText);
|
|
46
47
|
throw new Error("Fetching votes failed.");
|
|
47
48
|
}
|
|
48
49
|
const votes = (await response.json());
|
|
49
50
|
return votes;
|
|
50
51
|
}
|
|
51
52
|
catch (error) {
|
|
52
|
-
|
|
53
|
+
log.error("Error fetching votes:", error);
|
|
53
54
|
throw error;
|
|
54
55
|
}
|
|
55
56
|
}
|
|
@@ -64,9 +65,9 @@ function calculateElo(rating1, rating2, score1, score2) {
|
|
|
64
65
|
export async function exportChoiceVotes(workPackage, done) {
|
|
65
66
|
try {
|
|
66
67
|
await updateUploadJobStatus(workPackage.jobId, 5);
|
|
67
|
-
|
|
68
|
+
log.info(`Exporting choice votes for question ${workPackage.questionId} with utm_source ${workPackage.utmSource}`);
|
|
68
69
|
const choices = (await fetchChoices(workPackage.questionId, workPackage.utmSource));
|
|
69
|
-
|
|
70
|
+
log.info(`Found ${choices.length} choices`);
|
|
70
71
|
const workbook = new ExcelJS.Workbook();
|
|
71
72
|
const choicesSheet = workbook.addWorksheet("Choices");
|
|
72
73
|
const winningVotesSheet = workbook.addWorksheet("Winning Votes");
|
|
@@ -129,7 +130,7 @@ export async function exportChoiceVotes(workPackage, done) {
|
|
|
129
130
|
choice.user_created ? "User" : "Seed",
|
|
130
131
|
]);
|
|
131
132
|
votes.winning_votes.forEach((vote) => {
|
|
132
|
-
|
|
133
|
+
log.info(`${vote.tracking ? JSON.stringify(vote.tracking) : ""}`);
|
|
133
134
|
winningVotesSheet.addRow([
|
|
134
135
|
vote.id,
|
|
135
136
|
vote.voter_id,
|
|
@@ -199,33 +200,33 @@ export async function exportChoiceVotes(workPackage, done) {
|
|
|
199
200
|
// Note: Adjust the cell reference as needed
|
|
200
201
|
if (eloRating) {
|
|
201
202
|
choicesSheet.getCell(`H${i + 2}`).value = Math.round(eloRating);
|
|
202
|
-
|
|
203
|
+
log.info(`Choice ${choice.id} has elo rating ${Math.round(eloRating)}`);
|
|
203
204
|
}
|
|
204
205
|
else {
|
|
205
|
-
|
|
206
|
+
log.error(`Choice ${choice.id} has no elo rating`);
|
|
206
207
|
}
|
|
207
208
|
});
|
|
208
209
|
// Generate and upload the workbook to S3
|
|
209
210
|
const buffer = await workbook.xlsx.writeBuffer();
|
|
210
211
|
const filename = `choice_votes_${uuidv4()}.xlsx`;
|
|
211
|
-
|
|
212
|
+
log.info(`Uploading choice votes to S3: ${filename}`);
|
|
212
213
|
uploadToS3(workPackage.jobId, `${workPackage.userId}`, filename, workPackage.exportType, buffer, async (error, url) => {
|
|
213
214
|
if (error) {
|
|
214
|
-
|
|
215
|
+
log.error("Error uploading choice votes to S3:", error);
|
|
215
216
|
done(error, url);
|
|
216
217
|
}
|
|
217
218
|
else {
|
|
218
|
-
|
|
219
|
+
log.info(`Uploaded choice votes to S3: ${url}`);
|
|
219
220
|
await updateUploadJobStatus(workPackage.jobId, 100, {
|
|
220
221
|
reportUrl: url,
|
|
221
222
|
});
|
|
222
223
|
done(undefined, url);
|
|
223
224
|
}
|
|
224
225
|
});
|
|
225
|
-
|
|
226
|
+
log.info(`Successfully exported and uploaded choice votes for question ${workPackage.questionId}`);
|
|
226
227
|
}
|
|
227
228
|
catch (error) {
|
|
228
|
-
|
|
229
|
+
log.error("Error exporting choice votes:", error);
|
|
229
230
|
await setJobError(workPackage.jobId, "Error exporting choice votes");
|
|
230
231
|
done(error);
|
|
231
232
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const models = require("../../../models/index.cjs");
|
|
3
3
|
const async = require("async");
|
|
4
4
|
const moment = require("moment");
|
|
5
|
-
const log = require("
|
|
5
|
+
const log = require("../../../utils/logger.cjs");
|
|
6
6
|
const _ = require("lodash");
|
|
7
7
|
const Excel = require("exceljs");
|
|
8
8
|
const getGroupPosts = require("./common_utils.cjs").getGroupPosts;
|
|
@@ -243,7 +243,7 @@ const createXlsCommunityUsersReport = (workPackage, callback) => {
|
|
|
243
243
|
seriesCallback(error);
|
|
244
244
|
}
|
|
245
245
|
else {
|
|
246
|
-
|
|
246
|
+
log.info(`Updating job 100 with DATA`);
|
|
247
247
|
models.AcBackgroundJob.update({
|
|
248
248
|
progress: 100,
|
|
249
249
|
data: { reportUrl },
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const models = require("../../../models/index.cjs");
|
|
3
3
|
const async = require("async");
|
|
4
4
|
const moment = require("moment");
|
|
5
|
-
const log = require("
|
|
5
|
+
const log = require("../../../utils/logger.cjs");
|
|
6
6
|
const _ = require("lodash");
|
|
7
7
|
const Excel = require("exceljs");
|
|
8
8
|
const getPointsUp = require("./common_utils.cjs").getPointsUp;
|