udata 10.4.3.dev35617__py2.py3-none-any.whl → 10.4.3.dev35680__py2.py3-none-any.whl
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.
Potentially problematic release.
This version of udata might be problematic. Click here for more details.
- udata/core/dataservices/models.py +5 -0
- udata/core/dataset/models.py +7 -0
- udata/core/organization/models.py +29 -2
- udata/core/reuse/models.py +5 -0
- udata/harvest/api.py +2 -1
- udata/static/chunks/{11.b6f741fcc366abfad9c4.js → 11.51d706fb9521c16976bc.js} +3 -3
- udata/static/chunks/{11.b6f741fcc366abfad9c4.js.map → 11.51d706fb9521c16976bc.js.map} +1 -1
- udata/static/chunks/{13.2d06442dd9a05d9777b5.js → 13.39e106d56f794ebd06a0.js} +2 -2
- udata/static/chunks/{13.2d06442dd9a05d9777b5.js.map → 13.39e106d56f794ebd06a0.js.map} +1 -1
- udata/static/chunks/{17.e8e4caaad5cb0cc0bacc.js → 17.70cbb4a91b002338007e.js} +2 -2
- udata/static/chunks/{17.e8e4caaad5cb0cc0bacc.js.map → 17.70cbb4a91b002338007e.js.map} +1 -1
- udata/static/chunks/{19.f03a102365af4315f9db.js → 19.a348a5fff8fe2801e52a.js} +3 -3
- udata/static/chunks/{19.f03a102365af4315f9db.js.map → 19.a348a5fff8fe2801e52a.js.map} +1 -1
- udata/static/chunks/{5.0fa1408dae4e76b87b2e.js → 5.343ca020a2d38cec1a14.js} +3 -3
- udata/static/chunks/{5.0fa1408dae4e76b87b2e.js.map → 5.343ca020a2d38cec1a14.js.map} +1 -1
- udata/static/chunks/{6.d663709d877baa44a71e.js → 6.a3b07de9dd2ca2d24e85.js} +3 -3
- udata/static/chunks/{6.d663709d877baa44a71e.js.map → 6.a3b07de9dd2ca2d24e85.js.map} +1 -1
- udata/static/chunks/{8.778091d55cd8ea39af6b.js → 8.462bb3029de008497675.js} +2 -2
- udata/static/chunks/{8.778091d55cd8ea39af6b.js.map → 8.462bb3029de008497675.js.map} +1 -1
- udata/static/common.js +1 -1
- udata/static/common.js.map +1 -1
- {udata-10.4.3.dev35617.dist-info → udata-10.4.3.dev35680.dist-info}/METADATA +3 -1
- {udata-10.4.3.dev35617.dist-info → udata-10.4.3.dev35680.dist-info}/RECORD +27 -27
- {udata-10.4.3.dev35617.dist-info → udata-10.4.3.dev35680.dist-info}/LICENSE +0 -0
- {udata-10.4.3.dev35617.dist-info → udata-10.4.3.dev35680.dist-info}/WHEEL +0 -0
- {udata-10.4.3.dev35617.dist-info → udata-10.4.3.dev35680.dist-info}/entry_points.txt +0 -0
- {udata-10.4.3.dev35617.dist-info → udata-10.4.3.dev35680.dist-info}/top_level.txt +0 -0
|
@@ -17,6 +17,7 @@ from udata.core.dataservices.constants import (
|
|
|
17
17
|
DATASERVICE_FORMATS,
|
|
18
18
|
)
|
|
19
19
|
from udata.core.dataset.models import Dataset
|
|
20
|
+
from udata.core.metrics.helpers import get_stock_metrics
|
|
20
21
|
from udata.core.metrics.models import WithMetrics
|
|
21
22
|
from udata.core.owned import Owned, OwnedQuerySet
|
|
22
23
|
from udata.i18n import lazy_gettext as _
|
|
@@ -288,6 +289,7 @@ class Dataservice(Auditable, WithMetrics, Owned, db.Document):
|
|
|
288
289
|
__metrics_keys__ = [
|
|
289
290
|
"discussions",
|
|
290
291
|
"followers",
|
|
292
|
+
"followers_by_months",
|
|
291
293
|
"views",
|
|
292
294
|
]
|
|
293
295
|
|
|
@@ -313,6 +315,9 @@ class Dataservice(Auditable, WithMetrics, Owned, db.Document):
|
|
|
313
315
|
|
|
314
316
|
def count_followers(self):
|
|
315
317
|
self.metrics["followers"] = Follow.objects(until=None).followers(self).count()
|
|
318
|
+
self.metrics["followers_by_months"] = get_stock_metrics(
|
|
319
|
+
Follow.objects(following=self), date_label="since"
|
|
320
|
+
)
|
|
316
321
|
self.save(signal_kwargs={"ignores": ["post_save"]})
|
|
317
322
|
|
|
318
323
|
|
udata/core/dataset/models.py
CHANGED
|
@@ -20,6 +20,7 @@ from udata.api_fields import field
|
|
|
20
20
|
from udata.app import cache
|
|
21
21
|
from udata.core import storages
|
|
22
22
|
from udata.core.activity.models import Auditable
|
|
23
|
+
from udata.core.metrics.helpers import get_stock_metrics
|
|
23
24
|
from udata.core.owned import Owned, OwnedQuerySet
|
|
24
25
|
from udata.frontend.markdown import mdstrip
|
|
25
26
|
from udata.i18n import lazy_gettext as _
|
|
@@ -599,7 +600,9 @@ class Dataset(Auditable, WithMetrics, DatasetBadgeMixin, Owned, db.Document):
|
|
|
599
600
|
__metrics_keys__ = [
|
|
600
601
|
"discussions",
|
|
601
602
|
"reuses",
|
|
603
|
+
"reuses_by_months",
|
|
602
604
|
"followers",
|
|
605
|
+
"followers_by_months",
|
|
603
606
|
"views",
|
|
604
607
|
"resources_downloads",
|
|
605
608
|
]
|
|
@@ -1063,12 +1066,16 @@ class Dataset(Auditable, WithMetrics, DatasetBadgeMixin, Owned, db.Document):
|
|
|
1063
1066
|
from udata.models import Reuse
|
|
1064
1067
|
|
|
1065
1068
|
self.metrics["reuses"] = Reuse.objects(datasets=self).visible().count()
|
|
1069
|
+
self.metrics["reuses_by_months"] = get_stock_metrics(Reuse.objects(datasets=self).visible())
|
|
1066
1070
|
self.save(signal_kwargs={"ignores": ["post_save"]})
|
|
1067
1071
|
|
|
1068
1072
|
def count_followers(self):
|
|
1069
1073
|
from udata.models import Follow
|
|
1070
1074
|
|
|
1071
1075
|
self.metrics["followers"] = Follow.objects(until=None).followers(self).count()
|
|
1076
|
+
self.metrics["followers_by_months"] = get_stock_metrics(
|
|
1077
|
+
Follow.objects(following=self), date_label="since"
|
|
1078
|
+
)
|
|
1072
1079
|
self.save(signal_kwargs={"ignores": ["post_save"]})
|
|
1073
1080
|
|
|
1074
1081
|
|
|
@@ -8,6 +8,7 @@ from werkzeug.utils import cached_property
|
|
|
8
8
|
from udata.api_fields import field
|
|
9
9
|
from udata.core.activity.models import Auditable
|
|
10
10
|
from udata.core.badges.models import Badge, BadgeMixin, BadgesList
|
|
11
|
+
from udata.core.metrics.helpers import get_stock_metrics
|
|
11
12
|
from udata.core.metrics.models import WithMetrics
|
|
12
13
|
from udata.core.storages import avatars, default_image_basename
|
|
13
14
|
from udata.frontend.markdown import mdstrip
|
|
@@ -161,9 +162,16 @@ class Organization(Auditable, WithMetrics, OrganizationBadgeMixin, db.Datetimed,
|
|
|
161
162
|
return self.name or ""
|
|
162
163
|
|
|
163
164
|
__metrics_keys__ = [
|
|
165
|
+
"dataservices",
|
|
166
|
+
"dataservices_by_months",
|
|
164
167
|
"datasets",
|
|
168
|
+
"datasets_by_months",
|
|
169
|
+
"datasets_followers_by_months",
|
|
170
|
+
"datasets_reuses_by_months",
|
|
165
171
|
"members",
|
|
166
172
|
"reuses",
|
|
173
|
+
"reuses_by_months",
|
|
174
|
+
"reuses_followers_by_months",
|
|
167
175
|
"dataservices",
|
|
168
176
|
"followers",
|
|
169
177
|
"views",
|
|
@@ -299,21 +307,40 @@ class Organization(Auditable, WithMetrics, OrganizationBadgeMixin, db.Datetimed,
|
|
|
299
307
|
self.save(signal_kwargs={"ignores": ["post_save"]})
|
|
300
308
|
|
|
301
309
|
def count_datasets(self):
|
|
302
|
-
from udata.models import Dataset
|
|
310
|
+
from udata.models import Dataset, Follow, Reuse
|
|
303
311
|
|
|
304
312
|
self.metrics["datasets"] = Dataset.objects(organization=self).visible().count()
|
|
313
|
+
self.metrics["datasets_by_months"] = get_stock_metrics(
|
|
314
|
+
Dataset.objects(organization=self).visible(), date_label="created_at_internal"
|
|
315
|
+
)
|
|
316
|
+
self.metrics["datasets_followers_by_months"] = get_stock_metrics(
|
|
317
|
+
Follow.objects(following__in=Dataset.objects(organization=self)), date_label="since"
|
|
318
|
+
)
|
|
319
|
+
self.metrics["datasets_reuses_by_months"] = get_stock_metrics(
|
|
320
|
+
Reuse.objects(datasets__in=Dataset.objects(organization=self)).visible()
|
|
321
|
+
)
|
|
322
|
+
|
|
305
323
|
self.save(signal_kwargs={"ignores": ["post_save"]})
|
|
306
324
|
|
|
307
325
|
def count_reuses(self):
|
|
308
|
-
from udata.models import Reuse
|
|
326
|
+
from udata.models import Follow, Reuse
|
|
309
327
|
|
|
310
328
|
self.metrics["reuses"] = Reuse.objects(organization=self).visible().count()
|
|
329
|
+
self.metrics["reuses_by_months"] = get_stock_metrics(
|
|
330
|
+
Reuse.objects(organization=self).visible()
|
|
331
|
+
)
|
|
332
|
+
self.metrics["reuses_followers_by_months"] = get_stock_metrics(
|
|
333
|
+
Follow.objects(following__in=Reuse.objects(organization=self)), date_label="since"
|
|
334
|
+
)
|
|
311
335
|
self.save(signal_kwargs={"ignores": ["post_save"]})
|
|
312
336
|
|
|
313
337
|
def count_dataservices(self):
|
|
314
338
|
from udata.models import Dataservice
|
|
315
339
|
|
|
316
340
|
self.metrics["dataservices"] = Dataservice.objects(organization=self).visible().count()
|
|
341
|
+
self.metrics["dataservices_by_months"] = get_stock_metrics(
|
|
342
|
+
Dataservice.objects(organization=self).visible(), date_label="created_at"
|
|
343
|
+
)
|
|
317
344
|
self.save(signal_kwargs={"ignores": ["post_save"]})
|
|
318
345
|
|
|
319
346
|
def count_followers(self):
|
udata/core/reuse/models.py
CHANGED
|
@@ -5,6 +5,7 @@ from werkzeug.utils import cached_property
|
|
|
5
5
|
from udata.api_fields import field, function_field, generate_fields
|
|
6
6
|
from udata.core.activity.models import Auditable
|
|
7
7
|
from udata.core.dataset.api_fields import dataset_fields
|
|
8
|
+
from udata.core.metrics.helpers import get_stock_metrics
|
|
8
9
|
from udata.core.owned import Owned, OwnedQuerySet
|
|
9
10
|
from udata.core.reuse.api_fields import BIGGEST_IMAGE_SIZE, reuse_permissions_fields
|
|
10
11
|
from udata.core.storages import default_image_basename, images
|
|
@@ -151,6 +152,7 @@ class Reuse(db.Datetimed, Auditable, WithMetrics, ReuseBadgeMixin, Owned, db.Doc
|
|
|
151
152
|
"discussions",
|
|
152
153
|
"datasets",
|
|
153
154
|
"followers",
|
|
155
|
+
"followers_by_months",
|
|
154
156
|
"views",
|
|
155
157
|
]
|
|
156
158
|
|
|
@@ -299,6 +301,9 @@ class Reuse(db.Datetimed, Auditable, WithMetrics, ReuseBadgeMixin, Owned, db.Doc
|
|
|
299
301
|
from udata.models import Follow
|
|
300
302
|
|
|
301
303
|
self.metrics["followers"] = Follow.objects(until=None).followers(self).count()
|
|
304
|
+
self.metrics["followers_by_months"] = get_stock_metrics(
|
|
305
|
+
Follow.objects(following=self), date_label="since"
|
|
306
|
+
)
|
|
302
307
|
self.save(signal_kwargs={"ignores": ["post_save"]})
|
|
303
308
|
|
|
304
309
|
|
udata/harvest/api.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from flask import current_app, request
|
|
2
|
+
from flask_login import current_user
|
|
2
3
|
from werkzeug.exceptions import BadRequest
|
|
3
4
|
|
|
4
5
|
from udata.api import API, api, fields
|
|
@@ -345,7 +346,7 @@ class RunSourceAPI(API):
|
|
|
345
346
|
@api.marshal_with(source_fields)
|
|
346
347
|
def post(self, ident):
|
|
347
348
|
enabled = current_app.config.get("HARVEST_ENABLE_MANUAL_RUN")
|
|
348
|
-
if not enabled:
|
|
349
|
+
if not enabled and not current_user.sysadmin:
|
|
349
350
|
api.abort(
|
|
350
351
|
400,
|
|
351
352
|
"Cannot run source manually. Please contact the platform if you need to reschedule the harvester.",
|