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

Commit 0b4d1d1

Browse files
Merge pull request #185 from GoogleDeveloperExperts/fix-activity-link
Set default activityLink
2 parents d36edbc + cb2c5c0 commit 0b4d1d1

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
@@ -238,9 +238,10 @@ <h2>
238238

239239
},
240240
_isSubmitDisabled: function() {
241-
console.log(this.detail.detail_type && this.$.inputUrl.validate() && (this.detail.metric_reached > 0 || this.detail.metric_indirect > 0 || this.detail.metric_trained > 0));
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-
return (this.detail.detail_type && this.$.inputUrl.validate() && (this.detail.metric_reached > 0 || this.detail.metric_indirect > 0 || this.detail.metric_trained > 0));
241+
return this.detail.detail_type && this.$.inputUrl.validate() && this._metricExists();
242+
},
243+
_metricExists: function() {
244+
return [this.detail.metric_reached, this.detail.metric_indirect, this.detail.metric_trained].some(metric => metric > 0);
244245
},
245246
_initNewActivityDetailIfNeeded: function() {
246247
if (!this.detail.url) {
@@ -251,11 +252,10 @@ <h2>
251252
this.initial_detail_type = i;
252253
}
253254
}
254-
console.debug("[experts-activity-detail-create] _initNewActivityDetailIfNeeded ",{ detail: this.detail, initial_detail_type: this.initial_detail_type});
255255
},
256256
_initNewActivityDetail: function() {
257257
this.detail = {
258-
'detail_type': '',
258+
'detail_type': 'Generic URL',
259259
'url': '',
260260
'metric_reached': 0,
261261
'metric_indirect': 0,
@@ -278,7 +278,6 @@ <h2>
278278
if (!this.detail.metric_trained) {
279279
this.detail.metric_trained = 0;
280280
}
281-
console.debug("[experts-activity-detail-create] _submitActivityDetail ", this.detail);
282281

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

0 commit comments

Comments
 (0)