From 19d92ed965e06aa4c323434df7f4c7ab11ea0864 Mon Sep 17 00:00:00 2001
From: Sunairaa <66335481+Sunairaa@users.noreply.github.com>
Date: Tue, 20 Oct 2020 23:11:46 -0700
Subject: [PATCH 1/6] issue #1858 positioning submit btn
---
app/main/posts/modify/post-editor.html | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/app/main/posts/modify/post-editor.html b/app/main/posts/modify/post-editor.html
index e34ac8e77a..cc3f0d80f5 100644
--- a/app/main/posts/modify/post-editor.html
+++ b/app/main/posts/modify/post-editor.html
@@ -103,7 +103,19 @@
{{post.form.name}}
-->
+
-
From 0d880570865f1fdc81fda27f5da1c1aa8954e615 Mon Sep 17 00:00:00 2001
From: Angad Sethi
Date: Fri, 30 Oct 2020 14:02:24 +0530
Subject: [PATCH 2/6] Fixes trailing decimals and required decimal field
This commit removes the trailing zeros which are present in the record fetched from the database. In addition, it also fixes the default decimal field which now shows decimals.
---
app/main/posts/detail/post-value.directive.js | 7 +++++++
app/main/posts/modify/post-data-editor.directive.js | 3 ++-
app/main/posts/modify/post-editor.directive.js | 3 ++-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/app/main/posts/detail/post-value.directive.js b/app/main/posts/detail/post-value.directive.js
index b200be54c6..f4c85faac6 100644
--- a/app/main/posts/detail/post-value.directive.js
+++ b/app/main/posts/detail/post-value.directive.js
@@ -37,6 +37,13 @@ module.exports = ['PostEndpoint', 'moment', '_', function (PostEndpoint, moment,
return PostEndpoint.get({ id : entry });
});
}
+ // The below fix is to remove trailing decimals
+ // from the value fetched from the database.
+ if ($scope.attribute.type === 'decimal') {
+ $scope.value = $scope.value.map(function (entry) {
+ return parseFloat(entry);
+ });
+ }
if ($scope.attribute.input === 'tags') {
$scope.value = $scope.formatTags($scope.value);
}
diff --git a/app/main/posts/modify/post-data-editor.directive.js b/app/main/posts/modify/post-data-editor.directive.js
index 6466bcaa8c..47af07fc1b 100644
--- a/app/main/posts/modify/post-data-editor.directive.js
+++ b/app/main/posts/modify/post-data-editor.directive.js
@@ -259,7 +259,8 @@ function PostDataEditorController(
$scope.post.values[attr.key] = [null];
}
} else if (attr.input === 'number') {
- $scope.post.values[attr.key] = [parseInt(attr.default)];
+ // Using parseFloat to handle decimals too.
+ $scope.post.values[attr.key] = (attr.type === 'int') ? [parseInt(attr.default)] : [parseFloat(attr.default)];
} else if (attr.input === 'date' || attr.input === 'datetime') {
$scope.post.values[attr.key] = attr.default ? [new Date(attr.default)] : [new Date()];
} else {
diff --git a/app/main/posts/modify/post-editor.directive.js b/app/main/posts/modify/post-editor.directive.js
index 2a132bbeae..f85801a5ef 100644
--- a/app/main/posts/modify/post-editor.directive.js
+++ b/app/main/posts/modify/post-editor.directive.js
@@ -157,7 +157,8 @@ function PostEditorController(
$scope.post.values[attr.key] = [null];
}
} else if (attr.input === 'number') {
- $scope.post.values[attr.key] = [parseInt(attr.default)];
+ // Using parseFloat to handle decimals too.
+ $scope.post.values[attr.key] = (attr.type === 'int') ? [parseInt(attr.default)] : [parseFloat(attr.default)];
} else if (attr.input === 'date' || attr.input === 'datetime') {
// If there is a default value for this input type, parse it.
// If there isn't, display today's date if it is a required field,
From 648bca247a6328f9214963c5adfbef928ec37f00 Mon Sep 17 00:00:00 2001
From: Romina
Date: Mon, 16 Nov 2020 17:01:29 -0300
Subject: [PATCH 3/6] fix(MapView stats): use the stats endpoint instead of
counting the geojson entries since we can get the same info
---
.../posts/views/post-view-map.directive.js | 34 ++++++++++++++++---
1 file changed, 30 insertions(+), 4 deletions(-)
diff --git a/app/main/posts/views/post-view-map.directive.js b/app/main/posts/views/post-view-map.directive.js
index 92c8dbf692..1f5793520e 100644
--- a/app/main/posts/views/post-view-map.directive.js
+++ b/app/main/posts/views/post-view-map.directive.js
@@ -144,11 +144,37 @@ function PostViewMap(PostEndpoint, Maps, _, PostFilters, L, $q, $rootScope, $com
function getStats () {
// Getting stats for filter-dropdown
- let def = PostFilters.getQueryParams(PostFilters.getDefaults());
- PostEndpoint.geojson(def).$promise.then(res => {
- $scope.stats.totalItems = res.features.length;
- $scope.stats.unmapped = res.total - res.features.length;
+ getPostStats(PostFilters.getDefaults()).$promise.then(function (result) {
+ $scope.stats.totalItems = result.totals[0].values.reduce(
+ function (a,b) {
+ return a.total + b.total
+ }
+ );
+
+ $scope.stats.unmapped = result.unmapped;
+ });
+ }
+
+ function getPostStats(filters) {
+ var query = PostFilters.getQueryParams(filters);
+ var queryParams = _.extend({}, query, {
+ include_unmapped: true,
+ status: 'all'
});
+
+ // we don't want a group_by or filter
+ if (queryParams.form) {
+ delete queryParams.form;
+ }
+ if (queryParams.group_by) {
+ delete queryParams.group_by;
+ }
+
+ // deleting source, we want stats for all datasources to keep the datasource-bucket-stats unaffected by data-source-filters
+ if (queryParams.source) {
+ delete queryParams.source;
+ }
+ return PostEndpoint.stats(queryParams);
}
function loadPosts(query) {
From 6e0b49acaed7d8bacfc594529da9987e6d77720a Mon Sep 17 00:00:00 2001
From: Anna
Date: Tue, 17 Nov 2020 13:22:17 +0100
Subject: [PATCH 4/6] Fixing broken datepicker in filter-dropdown #4169
---
app/main/posts/views/filters/filter-date.html | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/app/main/posts/views/filters/filter-date.html b/app/main/posts/views/filters/filter-date.html
index 6271a5524c..bec6b7069f 100644
--- a/app/main/posts/views/filters/filter-date.html
+++ b/app/main/posts/views/filters/filter-date.html
@@ -1,24 +1,25 @@