Skip to content

Commit

Permalink
Merge pull request #46 from LCOGT/science_support_fixes
Browse files Browse the repository at this point in the history
Science support fixes
  • Loading branch information
jnation3406 committed Jul 3, 2019
2 parents 2216c15 + 4c0249a commit 8a9c93a
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.2 on 2019-07-02 20:14

import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('requestgroups', '0010_auto_20190612_0048'),
]

operations = [
migrations.AlterField(
model_name='target',
name='eccentricity',
field=models.FloatField(blank=True, help_text='Eccentricity of the orbit', null=True, validators=[django.core.validators.MinValueValidator(0.0)]),
),
]
2 changes: 1 addition & 1 deletion observation_portal/requestgroups/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ class Target(models.Model):
help_text='Perihelion distance (AU)'
)
eccentricity = models.FloatField(
null=True, blank=True, validators=[MinValueValidator(0.0), MaxValueValidator(0.99)],
null=True, blank=True, validators=[MinValueValidator(0.0)],
help_text='Eccentricity of the orbit'
)
meanlong = models.FloatField(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ <h3>Need help?</h3>
{% bootstrap_label '<i class="fas fa-sync"></i> State' label_for="id_state" %}
{% bootstrap_field filter.form.state show_label=False size='small' %}

{% bootstrap_label '<i class="fa fa-paragraph"></i> Name Contains' label_for="id_name" %}
{% bootstrap_field filter.form.name show_label=False size='small' %}

{% bootstrap_label '<i class="fa fa-crosshairs"></i> Target Name Contains' label_for="id_target" %}
{% bootstrap_field filter.form.target show_label=False size='small' %}

Expand Down
8 changes: 8 additions & 0 deletions static/js/components/instrumentconfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
:label="opticalElementGroup.label"
:field="opticalElementGroup.type"
:options="opticalElementGroup.options"
:lowerOptions="true"
:errors="{}"
@input="updateOpticalElement"
/>
Expand Down Expand Up @@ -170,6 +171,13 @@ export default {
opticalElementUpdates: 0
}
},
mounted: function() {
// If a draft is loaded in that has a defocus set in the extra_params, update the defocus
// here since extra_params is not reactive and cannot be watched
if (this.instrumentconfig.extra_params.defocus) {
this.defocus = this.instrumentconfig.extra_params.defocus;
}
},
computed: {
instrumentHasRotatorModes: function() {
return this.available_instruments[this.selectedinstrument] && 'rotator' in this.available_instruments[this.selectedinstrument].modes;
Expand Down
5 changes: 3 additions & 2 deletions static/js/components/request.vue
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,9 @@
if ('largest_interval' in this.duration_data) {
let num_exposures = this.request.configurations[ids.configId].instrument_configs[ids.instrumentconfigId].exposure_count;
let instrumentconfig_duration = this.duration_data.configurations[ids.configId].instrument_configs[ids.instrumentconfigId].duration;
let available_time = this.duration_data.largest_interval - this.duration_data.duration + (instrumentconfig_duration * num_exposures);
num_exposures = Math.floor(available_time / instrumentconfig_duration);
let available_time = this.duration_data.largest_interval - this.duration_data.duration + instrumentconfig_duration;
let timePerImage = instrumentconfig_duration / num_exposures;
num_exposures = Math.floor(available_time / timePerImage);
this.request.configurations[ids.configId].instrument_configs[ids.instrumentconfigId].exposure_count = Math.max(1, num_exposures);
this.update();
}
Expand Down
28 changes: 25 additions & 3 deletions static/js/components/util/customselect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
</template>
<b-form-select
:id="field + '-select-' + $parent.id"
:value="value"
:value="value | toLowerCase(lowerOptions)"
:state="validationState"
:options="options"
:options="selectOptions"
@input="update($event)"
/>
<span
Expand Down Expand Up @@ -59,7 +59,8 @@
'field',
'options',
'errors',
'desc'
'desc',
'lowerOptions'
],
data: function() {
return {
Expand All @@ -79,6 +80,27 @@
} else {
return null;
}
},
selectOptions: function() {
if (this.lowerOptions) {
return _.mapValues(this.options, function(opt) {
if (_.isString(opt.value)) {
return {value: _.toLower(opt.value), text: opt.text};
} else {
return {value: opt.value, text: opt.text};
}
});
} else {
return this.options;
}
}
},
filters: {
toLowerCase: function(value, lowerOptions) {
if (lowerOptions && _.isString(value)) {
return _.toLower(value);
}
return value;
}
},
methods: {
Expand Down
2 changes: 1 addition & 1 deletion static/js/request_row.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ $(document).ready(function() {
$('.pending-details').each(function() {
let that = $(this);
let requestId = $(this).data('request');
$.getJSON('/api/requests/' + requestId + '/?exclude_canceled=true', function(data) {
$.getJSON('/api/requests/' + requestId + '/observations/?exclude_canceled=true', function(data) {
let content = '';
if (data.length > 0) {
data = data.reverse(); // get the latest non canceled block
Expand Down

0 comments on commit 8a9c93a

Please sign in to comment.