Skip to content
This repository has been archived by the owner on Aug 21, 2023. It is now read-only.

Add percentile extra params #230

Merged
merged 4 commits into from
Sep 5, 2017
Merged

Conversation

fungjj92
Copy link
Contributor

@fungjj92 fungjj92 commented Aug 31, 2017

Overview

Adding the percentile params part of the extra params feature set.

Demo

screen shot 2017-08-31 at 1 14 07 pm

Notes

I struggled with the copy.. Alternative ideas:

_ percentile of percentile low temperature
Low temperature projections at percentile: __

Eh none of them are very good. @jcahail @CloudNiner

Testing Instructions

The usual npm run serve

Closes #204

@fungjj92 fungjj92 force-pushed the feature/jf/percentile-params branch 3 times, most recently from 463791f to 022d1c9 Compare August 31, 2017 17:32
Copy link
Contributor

@flibbertigibbet flibbertigibbet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't compile, due to apparent rebase against develop. See note on extending interface (must now list properties of parent's params).

const thresholdParams = $event.data as ThresholdIndicatorQueryOpts;
this.extraParams = thresholdParams;
this.onExtraParamsChanged.emit(this.extraParams);
this.updateChart(this.extraParams);
}

public onPercentileSelected($event) {
const percentileParams = $event.data;
console.log(percentileParams);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stray console log in here

'percentile_low_temperature',
'percentile_precipitation'
];

// TODO: concat additional extra parameter names to this array for #203, #204, and #205
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can remove #204 from TODO comment, which this closes

<form [formGroup]="percentileForm" novalidate>
<div class="chart-options-body form-group">
<span class="optional-parameters-label">Show {{indicator.label | lowercase}} at percentile
<input type="number"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could validate this to be in 0 to 100 range

* Chart component
* Container for each individual chart plus controls
* Threshold params component
* Multi-field form to allow user to specify threshold params
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

import { IndicatorQueryOpts } from './indicator-query-opts.model';

export interface PercentileIndicatorQueryOpts extends IndicatorQueryOpts {
params: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will need to list all the properties of the extended params object here after having rebased against develop, due to library updates

@flibbertigibbet
Copy link
Contributor

Still not compiling, but closer. Needs ClimateModel import.

@fungjj92 fungjj92 force-pushed the feature/jf/percentile-params branch 2 times, most recently from 0e8a1b2 to 1815c8a Compare August 31, 2017 19:57
@fungjj92
Copy link
Contributor Author

fungjj92 commented Sep 1, 2017

Technically this build succeeded, but a repeat build died due to a connection error

@flibbertigibbet
Copy link
Contributor

You can restart the build manually in the Jenkins interface.

@fungjj92 fungjj92 force-pushed the feature/jf/percentile-params branch from 1815c8a to c8bd5b6 Compare September 1, 2017 16:27
@fungjj92
Copy link
Contributor Author

fungjj92 commented Sep 1, 2017

Rebased against Andrew's merge

Copy link
Contributor

@flibbertigibbet flibbertigibbet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! One more thing: could use some more error handling. It's still possible to type invalid text (such as a decimal), which will result in an infinitely loading chart.

Copy link

@CloudNiner CloudNiner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad the rebase wasn't too bad!

@@ -26,3 +31,12 @@ export function hasExtraParams(indicatorName: string): boolean {
}
return false;
}

export function isPercentileIndicator(indicatorName: string): boolean {
for (const percentileName of percentileIndicatorNames) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly trivial comment, but is there a reason these functions can't all be compressed down to the more commonly used:

export function isPercentileIndicator(indicatorName: string): boolean {
    return percentileIndicatorNames.indexOf(indicatorName) !== -1;
}

@fungjj92 fungjj92 force-pushed the feature/jf/percentile-params branch from c8bd5b6 to 5906d6d Compare September 1, 2017 18:38
const pctl = form.percentileCtl;
if (pctl > 100 || pctl < 1) { return; }
this.percentileParamSelected.emit({
'percentile': Math.round(pctl)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using ng-pattern would be better, to enforce input restrictions rather than implicitly rounding what the user enters. ng-pattern="/^-?[0-9][^\.]*$/" should do the trick.

Although there are restrictions on the input now, there's no feedback to the user to indicate that the input is invalid; the chart simply fails to reload. It would be good to maybe highlight the field red or give some other error feedback.

@fungjj92 fungjj92 force-pushed the feature/jf/percentile-params branch from 1ef7c11 to 0b9192f Compare September 1, 2017 20:55
@fungjj92
Copy link
Contributor Author

fungjj92 commented Sep 1, 2017

Peh. I managed to rebase onto the basetemp merge, but didn't succeed at better validation.
Was playing around with this, to no avail:
http://cuppalabs.github.io/tutorials/how-to-implement-angular2-form-validations/

Copy link
Contributor

@flibbertigibbet flibbertigibbet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on tests passing and an issue made for form validation feedback (if it doesn't go in this PR).

Looks like there's a comma missing in the login component test. Maybe we should just remove that test, since it seems to be a hassle to maintain. It is the only component test we have, though.

If the form validation is too pesky, maybe can just make an issue for form feedback.

Copy link

@CloudNiner CloudNiner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flibbertigibbet since we've both approved this and @fungjj92 is out, can you create the referenced issue and get this merged?

@flibbertigibbet
Copy link
Contributor

There is a small issue causing tests to fail, which could be fixed up by a subsequent rebase in #242.

So yes, I'll do that.

@flibbertigibbet
Copy link
Contributor

Created #243

@flibbertigibbet flibbertigibbet force-pushed the feature/jf/percentile-params branch from 0b9192f to 26c02f3 Compare September 5, 2017 15:39
@flibbertigibbet
Copy link
Contributor

Just rebased in a fixup to the test commit, will merge on test pass

@flibbertigibbet flibbertigibbet force-pushed the feature/jf/percentile-params branch from 26c02f3 to f35712f Compare September 5, 2017 17:34
@flibbertigibbet
Copy link
Contributor

Had to do some significant rebasing; hopefully all sorted now

@flibbertigibbet flibbertigibbet merged commit 0927c2c into develop Sep 5, 2017
@flibbertigibbet flibbertigibbet deleted the feature/jf/percentile-params branch September 5, 2017 17:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants