Skip to content
This repository was archived by the owner on Aug 14, 2018. It is now read-only.

Commit cb2c5c0

Browse files
committed
Set default activityLink
Set default activityLink
1 parent a89db3b commit cb2c5c0

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/experts-activities/experts-activity-detail-create.html

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,10 @@ <h2>
239239

240240
},
241241
_isSubmitDisabled: function() {
242-
console.log(this.detail.detail_type && this.$.inputUrl.validate() && (this.detail.metric_reached > 0 || this.detail.metric_indirect > 0 || this.detail.metric_trained > 0));
243-
console.log(this.detail.detail_type, this.$.inputUrl.validate(), (this.detail.metric_reached > 0 || this.detail.metric_indirect > 0 || this.detail.metric_trained > 0));
244-
return (this.detail.detail_type && this.$.inputUrl.validate() && (this.detail.metric_reached > 0 || this.detail.metric_indirect > 0 || this.detail.metric_trained > 0));
242+
return this.detail.detail_type && this.$.inputUrl.validate() && this._metricExists();
243+
},
244+
_metricExists: function() {
245+
return [this.detail.metric_reached, this.detail.metric_indirect, this.detail.metric_trained].some(metric => metric > 0);
245246
},
246247
_initNewActivityDetailIfNeeded: function() {
247248
if (!this.detail.url) {
@@ -252,11 +253,10 @@ <h2>
252253
this.initial_detail_type = i;
253254
}
254255
}
255-
console.debug("[experts-activity-detail-create] _initNewActivityDetailIfNeeded ",{ detail: this.detail, initial_detail_type: this.initial_detail_type});
256256
},
257257
_initNewActivityDetail: function() {
258258
this.detail = {
259-
'detail_type': '',
259+
'detail_type': 'Generic URL',
260260
'url': '',
261261
'metric_reached': 0,
262262
'metric_indirect': 0,
@@ -279,7 +279,6 @@ <h2>
279279
if (!this.detail.metric_trained) {
280280
this.detail.metric_trained = 0;
281281
}
282-
console.debug("[experts-activity-detail-create] _submitActivityDetail ", this.detail);
283282

284283
var request = this.$.insertActivityDetail;
285284
request.body = JSON.stringify(this.detail);
@@ -303,7 +302,6 @@ <h2>
303302
this.close();
304303
},
305304
_activityLinkSelected: function(evt, obj) {
306-
console.debug("[experts-activity-create] _activityLinkSelected", obj.item.dataLink);
307305
this._chosenActivityLink = obj.item.dataLink;
308306
this._activateMetrics = true;
309307
},

0 commit comments

Comments
 (0)