Skip to content

Commit

Permalink
fix: remove console logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ChinHairSaintClair committed Nov 6, 2024
1 parent d0a9a86 commit 9526730
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions webapp/src/ts/modules/contacts/contacts-edit.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ export class ContactsEditComponent implements OnInit, OnDestroy, AfterViewInit {

// When using the link to go to another form, we need to clean up the duplicate section
if (this.needsCleanup){
console.log('Cleaning up duplicate section');
this.cleanUpDuplicateSection();
this.needsCleanup = false;
}
Expand Down Expand Up @@ -380,8 +379,6 @@ export class ContactsEditComponent implements OnInit, OnDestroy, AfterViewInit {
private parseXmlForm(form): Document | undefined {
// Below line is taken from enketo-core form-model line 114
const xmlDoc = this.parser.parseFromString(form.getDataStr({ irrelevant: false }), 'text/xml');
console.log('Doc');
console.log(xmlDoc);
if (xmlDoc.getElementsByTagName('parsererror').length > 0) {
console.error('Error parsing XML:', xmlDoc.getElementsByTagName('parsererror')[0].textContent);
this.globalActions.setEnketoError('Error parsing xml document');
Expand All @@ -401,8 +398,6 @@ export class ContactsEditComponent implements OnInit, OnDestroy, AfterViewInit {
XPathResult.STRING_TYPE,
null
).stringValue;

console.log(`Value of ${path}: `, value);
values.push(value);
} catch (error) {
console.error(`Path ${path} value could not be resolved!`);
Expand All @@ -413,11 +408,7 @@ export class ContactsEditComponent implements OnInit, OnDestroy, AfterViewInit {

private queryPropInfo(xmlDoc: Document, info: Exclude<QueryParamsInfoType, undefined>){
const propPaths = info.valuePaths;
console.log('Query prop paths: ', propPaths);

const values = this.getFormValues(xmlDoc, propPaths);

console.log('Function: ', info.query);
const result = info.query(...values);
return result;
}
Expand All @@ -429,7 +420,6 @@ export class ContactsEditComponent implements OnInit, OnDestroy, AfterViewInit {
for (const field of props) {
if (Object.prototype.hasOwnProperty.call(sibling, field.compareToDocProp)) {
const test = this.strategy(field.value.toLowerCase(), sibling[field.compareToDocProp].toLowerCase());
console.log(`${field.value.toLowerCase()} vs: ${sibling[field.compareToDocProp].toLowerCase()} Score: ${test}`);
totalScore += test;
count++;
}
Expand All @@ -441,11 +431,8 @@ export class ContactsEditComponent implements OnInit, OnDestroy, AfterViewInit {
private getLikelyDuplicates(siblings: Sibling[], props: {value: string; compareToDocProp: string}[]){
const duplicates: Array<Duplicate> = [];
for (const sibling of siblings){
console.log('Props to check: ', props);
const score = this.calculateSiblingLikenessScore(sibling, props);
console.log('Calculated avg score: ', score);
if (score !== null && score < this.duplicateThreshold){
console.log('Adding to duplicate list');
duplicates.push({_id: sibling._id, name: sibling.name, reported_date: sibling.reported_date, score});
}
}
Expand All @@ -471,7 +458,6 @@ export class ContactsEditComponent implements OnInit, OnDestroy, AfterViewInit {

private cleanUpDuplicateSection() {
const $duplicateInfoElement = $('#contact-form').find('#duplicate_info');
console.log($duplicateInfoElement);
$duplicateInfoElement.empty(); // Remove all child nodes
$duplicateInfoElement.hide();
}
Expand Down Expand Up @@ -501,7 +487,6 @@ export class ContactsEditComponent implements OnInit, OnDestroy, AfterViewInit {

private outputDuplicates(duplicates: Duplicate[]){
const $duplicateInfoElement = $('#contact-form').find('#duplicate_info');
console.log($duplicateInfoElement);
$duplicateInfoElement.empty(); // Remove all child nodes
$duplicateInfoElement.show();
// TODO: create a template component where these values are fed into.
Expand All @@ -514,7 +499,6 @@ export class ContactsEditComponent implements OnInit, OnDestroy, AfterViewInit {
}
$duplicateInfoElement.append(content);
$duplicateInfoElement.on('click', '.duplicate-navigate-link', () => {
console.log('Flagging for cleanup');
this.needsCleanup = true;
});
}
Expand Down Expand Up @@ -560,20 +544,15 @@ export class ContactsEditComponent implements OnInit, OnDestroy, AfterViewInit {
}

const shouldCircumventDuplicateCheck = this.queryParams ? this.queryPropInfo(xmlDoc, this.queryParams) : false;
console.log('Should circumvent duplicate check: ', shouldCircumventDuplicateCheck);

return this.allSettledFallback([form.validate(), this.dbLookupRef])
.then((results) => {
console.log('Intercepting and doing my cool thing here.');
console.log(results);

let valid = results[0].status === 'fulfilled'? results[0].value : false;

if (valid && !shouldCircumventDuplicateCheck) {
if (results[1].status === 'fulfilled'){
const additionalCheckResult = results[1].value;
const map = additionalCheckResult.rows.map((row: { doc: Sibling }) => row.doc);
console.log(map);
valid = this.ensureUniqueItem(xmlDoc, docId, map);
} else {
valid = false;
Expand Down

0 comments on commit 9526730

Please sign in to comment.