-
-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(#9601): prototype duplicate prevention #9609
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,22 @@ window.startupTimes.firstCodeExecution = performance.now(); | |
|
||
window.PouchDB = require('pouchdb-browser').default; | ||
window.$ = window.jQuery = require('jquery'); | ||
window._phdcChanges = { | ||
hierarchyDuplicatePrevention: { | ||
health_center: { | ||
...Levenshtein, | ||
props: [ | ||
{form_prop_path: `/data/health_center/name`, db_doc_ref: 'name'}, | ||
{form_prop_path: '/data/health_center/external_id', db_doc_ref: 'external_id'} | ||
], | ||
queryParams: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe |
||
valuePaths: ['/data/health_center/is_user_flagged_duplicate', '/data/health_center/duplicate/action'], | ||
// eslint-disable-next-line eqeqeq | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jkuester Continuing to lobby for |
||
query: (duplicate, action) => duplicate === 'yes' && action != null | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jkuester @ChinHairSaintClair My feeling here is that this would need to end up with some kind of operator syntax support that lets the user do logic, maybe something like (though doesn't have to be) JsonLogic: https://jsonlogic.com/ The way I see it there are two point of config -- the excel files and the configuration json -- and probably neither should take serialised JS (?). If we return the let andOnly = {
logic: [
[
// array bracket denotes a logical grouping
{
key1: { with: value, op: $in },
key2: { with: value, op: $contains },
key3: { with: value, op: $eq },
},
{
key1: { with: value, op: $in },
key2: { with: value, op: $ne },
key3: { with: value, op: $startsWith },
},
],
],
};
let orWithNestedAnds = {
logic: [
[
{
key1: { with: value, op: $in },
},
{
key2: { with: value, op: $eq },
},
],
// each grouping in its own bracket
[
{
key1: { with: value, op: $in },
},
{
key2: { with: value, op: $in },
},
],
],
};
let orWithNestedOrWithNestedAnds = {
logic: [
[
{
key1: { with: value, op: $in },
},
{
key2: { with: value, op: $in },
},
],
// OR
[
[
// nested groupings acceptable
{
key1: { with: value, op: $ne },
},
// AND
{
key2: { with: value, op: $ne },
},
],
// OR
[
{
key1: { with: value, op: $contains },
},
// AND
{
key1: { with: value, op: $startsWith },
},
],
],
],
}; The other stuff seems easier to move to config. |
||
} | ||
} | ||
} | ||
}; | ||
|
||
import { enableProdMode } from '@angular/core'; | ||
import '@angular/compiler'; | ||
|
@@ -19,6 +35,7 @@ import { environment } from '@mm-environments/environment'; | |
import { POUCHDB_OPTIONS } from './constants'; | ||
|
||
import * as bootstrapper from '../js/bootstrapper'; | ||
import { Levenshtein } from './polyfills'; | ||
|
||
// Moment additional locales | ||
require('../js/moment-locales/tl'); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
camelCase is the js standard.