@dhyasama/totem-models 9.45.4 → 9.46.0
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/lib/Financials.js +0 -31
- package/lib/Organization.js +1 -1
- package/package.json +1 -1
package/lib/Financials.js
CHANGED
|
@@ -319,8 +319,6 @@ module.exports = function(mongoose, config) {
|
|
|
319
319
|
|
|
320
320
|
Financials.statics.getByUUID = function getByUUID(uuid, cb) {
|
|
321
321
|
|
|
322
|
-
console.log('UUID: ' + uuid);
|
|
323
|
-
|
|
324
322
|
let self = this;
|
|
325
323
|
|
|
326
324
|
let query = self.findOne({
|
|
@@ -615,8 +613,6 @@ module.exports = function(mongoose, config) {
|
|
|
615
613
|
|
|
616
614
|
financials = financials || [];
|
|
617
615
|
|
|
618
|
-
console.log('count: ' + financials.length);
|
|
619
|
-
|
|
620
616
|
let results = [];
|
|
621
617
|
|
|
622
618
|
_.each(financials, function(financial) {
|
|
@@ -637,13 +633,6 @@ module.exports = function(mongoose, config) {
|
|
|
637
633
|
const sentToQueue = stakeholder.initial.sentToQueue;
|
|
638
634
|
const conditionsMet = sendToEmail && sendOnLessThanNow && !sentOn && !sentToQueue;
|
|
639
635
|
|
|
640
|
-
console.log(' uuid: ' + snapshot.uuid);
|
|
641
|
-
console.log(' sendToEmail: ' + sendToEmail);
|
|
642
|
-
console.log(' sendOnLessThanNow: ' + sendOnLessThanNow);
|
|
643
|
-
console.log(' sentOn: ' + sentOn);
|
|
644
|
-
console.log(' sentToQueue: ' + sentToQueue);
|
|
645
|
-
console.log(' conditionsMet: ' + conditionsMet);
|
|
646
|
-
|
|
647
636
|
if (conditionsMet) {
|
|
648
637
|
|
|
649
638
|
results.push({
|
|
@@ -811,12 +800,8 @@ module.exports = function(mongoose, config) {
|
|
|
811
800
|
|
|
812
801
|
Financials.statics.upsert = function upsert(financials, cb) {
|
|
813
802
|
|
|
814
|
-
console.log('Upsert financials');
|
|
815
|
-
|
|
816
803
|
if (!financials) { return cb(new Error('financials is required'), null); }
|
|
817
804
|
|
|
818
|
-
console.log('Upsert financials id: ' + financials._id.toString());
|
|
819
|
-
|
|
820
805
|
// Required for mixed types
|
|
821
806
|
financials.markModified('metrics');
|
|
822
807
|
financials.markModified('questions');
|
|
@@ -831,8 +816,6 @@ module.exports = function(mongoose, config) {
|
|
|
831
816
|
financials.markModified('investingActivities.breakdown');
|
|
832
817
|
financials.markModified('financingActivities.breakdown');
|
|
833
818
|
|
|
834
|
-
console.log('Upsert financials id: ' + financials._id.toString() + ' marked as modified');
|
|
835
|
-
|
|
836
819
|
financials.save(cb);
|
|
837
820
|
|
|
838
821
|
};
|
|
@@ -846,16 +829,10 @@ module.exports = function(mongoose, config) {
|
|
|
846
829
|
|
|
847
830
|
const updateStatus = function updateStatus(self) {
|
|
848
831
|
|
|
849
|
-
console.log('Financials update status begin');
|
|
850
|
-
|
|
851
832
|
_.each(self.snapshots, function(snapshot, index) {
|
|
852
833
|
|
|
853
|
-
console.log('Financials update status snapshot index ' + index.toString());
|
|
854
|
-
|
|
855
834
|
if (!snapshot) return;
|
|
856
835
|
|
|
857
|
-
console.log('Financials update status snapshot index ' + index.toString() + ' - 1');
|
|
858
|
-
|
|
859
836
|
var needsReview = snapshot.review;
|
|
860
837
|
var isSubmitted = snapshot.submittedOn;
|
|
861
838
|
var isApproved = snapshot.approvedOn;
|
|
@@ -863,8 +840,6 @@ module.exports = function(mongoose, config) {
|
|
|
863
840
|
var isArchived = snapshot.archivedOn;
|
|
864
841
|
var isOverdue = snapshot.dueOn ? moment(new Date()).isAfter(moment(snapshot.dueOn)) : false;
|
|
865
842
|
|
|
866
|
-
console.log('Financials update status snapshot index ' + index.toString() + ' - 2');
|
|
867
|
-
|
|
868
843
|
var isOpened = false;
|
|
869
844
|
var isDelivered = false;
|
|
870
845
|
if(snapshot.notifications && snapshot.notifications.company && snapshot.notifications.company.initial) {
|
|
@@ -872,8 +847,6 @@ module.exports = function(mongoose, config) {
|
|
|
872
847
|
isDelivered = snapshot.notifications.company.initial.sentOn;
|
|
873
848
|
}
|
|
874
849
|
|
|
875
|
-
console.log('Financials update status snapshot index ' + index.toString() + ' - 3');
|
|
876
|
-
|
|
877
850
|
if(!snapshot.uuid) snapshot.status = 'Completed'; // no uuid means the snapshot was created from the google sheet and should always be completed
|
|
878
851
|
else if(needsReview && isApproved) snapshot.status = 'Completed';
|
|
879
852
|
else if(!needsReview && isSubmitted) snapshot.status = 'Completed';
|
|
@@ -885,12 +858,8 @@ module.exports = function(mongoose, config) {
|
|
|
885
858
|
else if(isDelivered) snapshot.status = 'Delivered';
|
|
886
859
|
else snapshot.status = 'Upcoming'; // Upcoming is set when a snapshot is created to be sent to an org, typically within a minute or so
|
|
887
860
|
|
|
888
|
-
console.log('Financials update status snapshot index ' + index.toString() + ' - 4');
|
|
889
|
-
|
|
890
861
|
});
|
|
891
862
|
|
|
892
|
-
console.log('Financials update status end');
|
|
893
|
-
|
|
894
863
|
};
|
|
895
864
|
|
|
896
865
|
Financials.pre('init', function(next) {
|
package/lib/Organization.js
CHANGED
|
@@ -171,7 +171,7 @@ module.exports = function(mongoose, config) {
|
|
|
171
171
|
|
|
172
172
|
premium: { type: Boolean, default: false },
|
|
173
173
|
|
|
174
|
-
totemUrl: { type: String, trim: true, unique:
|
|
174
|
+
totemUrl: { type: String, trim: true, unique: false, partialFilterExpression : { type :"string" } },
|
|
175
175
|
|
|
176
176
|
logos: {
|
|
177
177
|
light: { type: String, trim: true },
|