Skip to content

Commit

Permalink
Merge branch 'master' into jls/lint-app-manager
Browse files Browse the repository at this point in the history
  • Loading branch information
orangejenny committed Jan 23, 2025
2 parents dc4784e + 4f78600 commit 25b301a
Show file tree
Hide file tree
Showing 186 changed files with 8,290 additions and 5,324 deletions.
32 changes: 22 additions & 10 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
language: en-US
early_access: true
reviews:
high_level_summary: false
review_status: false
poem: false
collapse_walkthrough: true
changed_files_summary: false
abort_on_close: true
auto_review:
enabled: false
auto_incremental_review: false
drafts: true
high_level_summary: false
review_status: false
poem: false
changed_files_summary: false
abort_on_close: true
instructions: >-
- Consider the [code review](https://github.com/dimagi/open-source/blob/master/docs/code_review.md) and [contributing](https://github.com/dimagi/commcare-hq/blob/master/CONTRIBUTING.rst)
guides when doing a review.
- Also follow the [project standards and best practices](https://github.com/dimagi/commcare-hq/blob/master/STANDARDS.rst) guide.
path_instructions:
- path: "**/*.js"
instructions: >-
- Review the JavaScript code against the [Google JavaScript style guide](https://google.github.io/styleguide/jsguide.html) and point out any mismatches
- Also follow [this guide](https://github.com/dimagi/commcare-hq/blob/master/docs/js-guide/code-review.rst)
- path: "**/*.py"
instructions: >-
- Review the code following best practises and standards
path_filters: ["**/*.js", "**/*.py", "**/*.md", "**/*.rst", "**/*.html"]
auto_review:
enabled: false
auto_incremental_review: false
drafts: false
21 changes: 2 additions & 19 deletions corehq/apps/api/domain_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,12 @@ def dehydrate_billing_properties(self, bundle):
}

def dehydrate_calculated_properties(self, bundle):
from corehq.toggles import CALCULATED_PROPERTIES_FROM_DOMAIN_METRICS, NAMESPACE_DOMAIN
calc_prop_prefix = 'cp_'
domain_obj = _get_domain(bundle)
try:
if CALCULATED_PROPERTIES_FROM_DOMAIN_METRICS.enabled(domain_obj.name, namespace=NAMESPACE_DOMAIN):
base_properties = self._get_base_properties_from_domain_metrics(domain_obj.name)
else:
base_properties = self._get_base_properties_from_elasticsearch(domain_obj.name, calc_prop_prefix)
base_properties = self._get_base_properties_from_domain_metrics(domain_obj.name)
properties = self._add_extra_calculated_properties(base_properties, domain_obj.name, calc_prop_prefix)
except (DomainMetrics.DoesNotExist, IndexError):
except (DomainMetrics.DoesNotExist):
logging.exception('Problem getting calculated properties for {}'.format(domain_obj.name))
return {}
return properties
Expand All @@ -74,19 +70,6 @@ def _get_base_properties_from_domain_metrics(domain):
domain_metrics = DomainMetrics.objects.get(domain=domain)
return domain_metrics.to_calculated_properties()

@staticmethod
def _get_base_properties_from_elasticsearch(domain, calc_prop_prefix):
es_data = (DomainES()
.in_domains([domain])
.size(1)
.run()
.hits[0])
return {
prop_name: es_data[prop_name]
for prop_name in es_data
if prop_name.startswith(calc_prop_prefix)
}

@staticmethod
def _add_extra_calculated_properties(properties, domain, calc_prop_prefix):
try:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
hqDefine('app_manager/js/forms/form_workflow', function () {
'use strict';
const uiElementKeyValueList = hqImport("hqwebapp/js/ui_elements/bootstrap3/ui-element-key-val-list");

hqDefine("app_manager/js/forms/form_workflow", [
"jquery",
"knockout",
"underscore",
"hqwebapp/js/ui_elements/bootstrap3/ui-element-key-val-list",
"hqwebapp/js/initial_page_data",
"hqwebapp/js/toggles",
], function (
$,
ko,
_,
uiElementKeyValueList,
initialPageData,
toggles,
) {
var FormWorkflow = function (options) {
var self = this;

Expand All @@ -17,7 +28,7 @@ hqDefine('app_manager/js/forms/form_workflow', function () {
self.hasError = ko.observable(self.workflow() === FormWorkflow.Values.ERROR);
self.hasWarning = ko.computed(function () {
return !self.hasError()
&& hqImport("hqwebapp/js/initial_page_data").get("is_case_list_form")
&& initialPageData.get("is_case_list_form")
&& self.workflow() !== FormWorkflow.Values.DEFAULT;
});

Expand Down Expand Up @@ -144,7 +155,7 @@ hqDefine('app_manager/js/forms/form_workflow', function () {
self.formId = ko.observable(formId);
self.autoLink = ko.observable();
self.allowManualLinking = ko.observable();
self.advancedMode = hqImport("hqwebapp/js/toggles").toggleEnabled('FORM_LINK_ADVANCED_MODE');
self.advancedMode = toggles.toggleEnabled('FORM_LINK_ADVANCED_MODE');
self.forms = workflow.forms || [];
self.datums = ko.observableArray();
self.manualDatums = ko.observable(false);
Expand Down
Loading

0 comments on commit 25b301a

Please sign in to comment.