Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faulty times #195

Open
wants to merge 6 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"apollo-client": "^2.0.1",
"apollo-client-preset": "^1.0.1",
"apollo-link-http": "^1.0.0",
"axios": "^0.18.1",
"axios": "^0.26.1",
"babel-preset-stage-0": "^6.24.1",
"bloomer": "^0.6.3",
"bulma": "^0.7.1",
Expand All @@ -26,7 +26,7 @@
"install": "^0.12.2",
"is-number": "^7.0.0",
"lodash": "^4.17.19",
"npm": "^6.14.6",
"npm": "^8.6.0",
"papaparse": "^5.2.0",
"prop-types": "^15.6.0",
"raven-js": "^3.22.2",
Expand Down Expand Up @@ -67,16 +67,16 @@
"babel-eslint": "^8.2.3",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"eslint": "^4.16.0",
"eslint": "^8.13.0",
"eslint-config-airbnb": "^16.1.0",
"eslint-config-airbnb-standard": "^1.6.6",
"eslint-config-airbnb-standard": "^3.1.0",
"eslint-config-prettier": "^2.6.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^5.1.1",
"eslint-plugin-prettier": "^2.5.0",
"eslint-plugin-react": "^7.5.1",
"prettier": "^1.10.2",
"prettier-standard": "^8.0.1",
"prettier-standard": "^16.4.1",
"react-app-rewire-eslint": "^0.2.3",
"react-app-rewired": "^1.5.2",
"react-test-renderer": "^16.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/actions/adminActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ export function fetchTacMembers() {
dispatch(failToGetTacMembers(e.message))
})
}
}
}
2 changes: 1 addition & 1 deletion src/actions/data-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function fetchAllData (defaultSemester, currentSemester, partner) {
const allocations = queryPartnerAllocations(defaultSemester, partner)
const tacMembers = queryTacMembers()
const saltUsers = querySaltUsers()
const statistics = queryStatistics(currentSemester, partner)
const statistics = queryStatistics(defaultSemester, partner)
const partnerAllocations = queryPartnerAllocations(defaultSemester)
await Promise.all([
saltAstronomers,
Expand Down
2 changes: 1 addition & 1 deletion src/actions/statisticsActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ export function fetchPartnerStatistics (semester, partner) {
dispatch(fetchPartnerStatisticsFail(e.message))
})
}
}
}
4 changes: 2 additions & 2 deletions src/api/graphQL.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ export function queryStatistics (semester, partner) {
return graphqlClient().post('/graphql', { query })
.then(
response => response.data.data.statistics
)
).catch(() => {})
}

export function queryPartnerStatProposals (semester, partner) {
Expand Down Expand Up @@ -481,7 +481,7 @@ export function queryPartnerStatProposals (semester, partner) {
return graphqlClient().post('/graphql-api', { query })
.then(
response => response.data.data.proposals
)
).catch(() => {})
}

export const submitAllocations = (query) => graphqlClient().post('/graphql', { query }).then(response => response)
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/PartnerStatPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export default connect(store => (
user: store.user.user,
partnerShareTimes: store.partnerShareTimes.partnerShareTimes,
loading: store.partnerStatProposals.fetching,
statistics: store.statistics.partnerStatistics,
statistics: store.statistics.statistics,
submittingCompletionComment: store.partnerStatProposals.submittingCompletionComment,
submittedCompletionComment: store.partnerStatProposals.submittedCompletionComment,
submittingCommentError: store.partnerStatProposals.errors.submittingCommentError
Expand Down
97 changes: 41 additions & 56 deletions src/components/pages/StatisticsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ import React from 'react'
import propTypes from 'prop-types'
import { connect } from 'react-redux'
import Plot from '../plots/Plot'
import InstrumentDistribution from '../plots/InstrumentDistribution'
import HrsModeDistribution from '../plots/HrsModeDistribution'
import RssModeDistribution from '../plots/RssModeDistribution'
import DeclinationDistribution from '../plots/DeclinationDistribution'
import RightAscensionDistribution from '../plots/RightAscensionDistribution'
import SalticamModeDistribution from '../plots/SalticamModeDistribution'
import TotalTimeDistribution from '../plots/TotalTimeDistribution'
import TransparencyDistributionHistogram from '../plots/TransparencyDistributionHistogram'
import TargetDistributionContourMap from '../plots/TargetDistributionContourMap'
Expand All @@ -25,12 +21,11 @@ import RSSDetectorModeTable from '../tables/statisticsTables/RSSDetectorModeTabl
import HRSStatistics from '../tables/statisticsTables/HRSStatistics'
import RSSObservingModeTable from '../tables/statisticsTables/RSSObservingModeTable'
import SALTICAMStatistics from '../tables/statisticsTables/SALTICAMStatistics'
import NoRejectedProposalsMessage from '../messages/NoRejectedProposalsMessage'

class StatisticsPage extends React.Component {

render() {
/* this will require me to difine a shape on PropTypes */
/* this will require me to define a shape on PropTypes */

const { filters, allocatedTime, targets, proposalsData, roles, statistics } = this.props
const { observingConditions, instruments, proposals: proposalStatistics } = statistics
Expand All @@ -45,7 +40,7 @@ class StatisticsPage extends React.Component {
)
}

let proposals = []
let proposals
if (partner === ALL_PARTNER) { // eslint-disable-next-line
proposals = proposalsData.proposals
}else{
Expand All @@ -54,23 +49,30 @@ class StatisticsPage extends React.Component {

return(
<div>
<NoRejectedProposalsMessage />
<div className='stat-wrapper'>
<ProposalCountTable proposalStatistics={ proposalStatistics } />
<PartnerTimeTable proposals={ proposals } allocatedTime={ allocatedTime } partner={ partner } semester={ semester }/>
<div className='stat-item'>
<ProposalCountTable proposalStatistics={ proposalStatistics } />
</div>
<div className='stat-item'>
<PartnerTimeTable proposals={ proposals } allocatedTime={ allocatedTime } partner={ partner } semester={ semester }/>
</div>
</div>
<h2><br/>Number of proposals vs Requested time</h2>

<div className='stat-wrapper-center'>
<TotalTimeDistribution
proposals={ proposals }
semester={ semester }
partner={ partner }
/>
<div className='stat-item'>
<h2>Number of proposals vs Requested time</h2>
<TotalTimeDistribution
proposals={ proposals }
semester={ semester }
partner={ partner }
/>
</div>
</div>
<div className='stat-wrapper' />

<div className='stat-wrapper-center'>
<TargetStatistics targets={ targets }/>
</div>

<div className='stat-wrapper'>
<Plot caption='Smoothed distribution of all targets on the sky.'>
<TargetDistributionContourMap targets={ targets }/>
Expand All @@ -79,63 +81,46 @@ class StatisticsPage extends React.Component {
<TargetDistributionScatterPlot targets={ targets }/>
</Plot>
</div>

<div className='stat-wrapper'>
<RightAscensionDistribution targets={ targets }/>
<DeclinationDistribution targets={ targets }/>
</div>

<h2>Seeing requests</h2>
<div className='stat-wrapper-center'>
<ObservingStatisticsSeeing seeingDistribution={ observingConditions.seeing }/>
</div>

<h2>Observing Conditions</h2>
<div className='stat-wrapper'>
<TransparencyDistributionHistogram
transparencyDistribution={ observingConditions.transparency }
/>
<ObservingStatisticsTransparency
transparencyDistribution={ observingConditions.transparency }
/>
</div>
<div className='stat-item'>
<ObservingStatisticsTransparency
transparencyDistribution={ observingConditions.transparency }
/>
<div >
<h2>Seeing requests</h2>
<ObservingStatisticsSeeing seeingDistribution={ observingConditions.seeing }/>
</div>
</div>

<div className='stat-wrapper'>
<InstrumentDistribution
timeRequestedPerInstrument={ {
salticam: instruments.scamRequestedTotal,
rss: instruments.rssRequestedTotal,
hrs: instruments.hrsRequestedTotal,
bvit: instruments.bvitRequestedTotal
} }
/>
<ConfigurationsStatistics numberOfConfigurationsPerInstrument={ {
salticam: instruments.scamTotal,
rss: instruments.rssTotal,
hrs: instruments.hrsTotal,
bvit: instruments.bvitTotal
} }/>
</div>
<div className='stat-wrapper-center'>
<RSSDetectorModeTable numberOfConfigurationsPerRssDetectorMode={ instruments.rssDetectorModeTotal }/>

<div className='stat-wrapper-center'>

<ConfigurationsStatistics numberOfConfigurationsPerInstrument={ {
salticam: instruments.scamTotal,
rss: instruments.rssTotal,
hrs: instruments.hrsTotal,
} }/>

</div>

<div className='stat-wrapper'>
<RssModeDistribution
numberOfConfigurationsPerRssObservingMode={ instruments.rssObservingModeTotal }
/>
<RSSDetectorModeTable numberOfConfigurationsPerRssDetectorMode={ instruments.rssDetectorModeTotal }/>
<RSSObservingModeTable numberOfConfigurationsPerRssObservingMode={ instruments.rssObservingModeTotal }/>
</div>
<h2>HRS Detector Mode</h2>

<div className='stat-wrapper'>
<HrsModeDistribution
timeRequestedPerHrsResolution={ instruments. hrsResolutionRequestedTotal }
/>
<HRSStatistics numberOfConfigurationsPerHrsResolution={ instruments. hrsResolutionTotal }/>
</div>
<h2>Salticam Detector Mode</h2>
<div className='stat-wrapper'>
<SalticamModeDistribution
timeRequestedPerSalticamDetectorMode={ instruments.salticamDetectorModeRequestedTotal }
/>
<SALTICAMStatistics
numberOfConfigurationsPerSalticamDetectorMode={ instruments.salticamDetectorModeTotal }
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/plots/RssModeDistribution.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ RssModeDistribution.propTypes = {
numberOfConfigurationsPerRssObservingMode: PropTypes.object.isRequired,
}

export default RssModeDistribution
export default RssModeDistribution
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function countInstruments (proposals){
const ConfigurationsStatistics = ({numberOfConfigurationsPerInstrument}) => {
const { rss, hrs, salticam, bvit } = numberOfConfigurationsPerInstrument
return(
<div className='stat-item'>
<div className='stat-item' style={ {textAlign: 'center', width: '100%'} }>
<h2>Configuration Statistics</h2>
<table className='stat-table'>
<thead>
Expand Down
1 change: 1 addition & 0 deletions src/components/tables/statisticsTables/HRSStatistics.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const HRSStatistics = ({numberOfConfigurationsPerHrsResolution}) => {
} = numberOfConfigurationsPerHrsResolution
return(
<div className='stat-item' style={ {textAlign: 'center'} }>
<h2>HRS Detector Mode</h2>
<table className='stat-table'>
<thead>
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { getPercentage, rounded } from '../../../util'
const ObservingStatisticsSeeing = ({ seeingDistribution }) => {
const { numberOfProposals, timeRequested } = seeingDistribution
const totalReqTime = timeRequested.lessEqual1Dot5 + timeRequested.lessEqual2 +
timeRequested.lessEqual3 + timeRequested.moreThan3
timeRequested.lessEqual2Dot5 + timeRequested.lessEqual3 + timeRequested.moreThan3

return(
<div className='stat-item' style={ {textAlign: 'left', width: '100%'} }>
<table className='stat-table' style={ {height: '100%'} }>
<div>
<table className='stat-table'>
<thead>
<tr>
<th className='width-150'>Conditions</th>
Expand All @@ -34,9 +34,9 @@ const ObservingStatisticsSeeing = ({ seeingDistribution }) => {
</tr>
<tr>
<td>Max Seeing <br /> &#x2266; 2.5</td>
<td>{ rounded(timeRequested.lessEqual1Dot5) }</td>
<td>{ numberOfProposals.lessEqual1Dot5 }</td>
<td>{ rounded(getPercentage(timeRequested.lessEqual1Dot5, totalReqTime), LOW_PRECISION) }</td>
<td>{ rounded(timeRequested.lessEqual2Dot5) }</td>
<td>{ numberOfProposals.lessEqual2Dot5 }</td>
<td>{ rounded(getPercentage(timeRequested.lessEqual2Dot5, totalReqTime), LOW_PRECISION) }</td>
</tr>
<tr>
<td>Max Seeing <br /> &#x2266; 3.0</td>
Expand All @@ -60,4 +60,4 @@ ObservingStatisticsSeeing.propTypes = {
seeingDistribution: propTypes.object.isRequired,
}

export default ObservingStatisticsSeeing
export default ObservingStatisticsSeeing
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const ObservingStatisticsTransparency = ({ transparencyDistribution }) => {
const { timeRequested, numberOfProposals } = transparencyDistribution
const totalReqTime = timeRequested.any + timeRequested.clear + timeRequested.thinCloud + timeRequested.thickCloud
return (
<div className='stat-item'>
<div>
<table className='stat-table'>
<thead>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion src/components/tables/statisticsTables/PartnerTimeTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const PartnerTimeTable = ({proposals, partner, allocatedTime, semester}) => {
const partnerAllocation = partnerAlloc(allocatedTime, partner)
const allocatedTimeSum = (partnerAllocation.p0p1 || 0) + (partnerAllocation.p2 || 0) + (partnerAllocation.p3 || 0)
return(
<div className='stat-item'>
<div>
<h2>Time for partner <strong>{partner}</strong></h2>
<table className='stat-table' style={ {height: '90%'} }>
<thead>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const ProposalCountTable = ({ proposalStatistics }) => {
newLongTermProposals
} = proposalStatistics
return(
<div className='stat-item'>
<div>
<h2>Submitted Proposals</h2>
<table className='stat-table' style={ {height: '90%'} }>
<thead>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import propTypes from 'prop-types'
const RSSDetectorModeTable = ({numberOfConfigurationsPerRssDetectorMode}) => {
const { driftScan, frameTransfer, normal, shuffle, slotMode } = numberOfConfigurationsPerRssDetectorMode
return(
<div className='stat-item' style={ {textAlign: 'center', width: '100%'} }>
<div className='stat-item' >
<h2>RSS Detector Mode</h2>
<table className='stat-table'>
{/* RSS Dictator mode */}
Expand Down Expand Up @@ -45,4 +45,4 @@ RSSDetectorModeTable.propTypes = {
numberOfConfigurationsPerRssDetectorMode: propTypes.object.isRequired,
}

export default RSSDetectorModeTable
export default RSSDetectorModeTable
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const RSSObservingModeTable = ({numberOfConfigurationsPerRssObservingMode}) => {
polarimetricImaging
} = numberOfConfigurationsPerRssObservingMode
return(
<div className='stat-item' style={ {textAlign: 'center'} }>
<div className='stat-item'>
<h2>RSS Observing Mode</h2>
<table className='stat-table'>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const SALTICAMStatistics = ({numberOfConfigurationsPerSalticamDetectorMode}) =>
} = numberOfConfigurationsPerSalticamDetectorMode
return(
<div className='stat-item' style={ {textAlign: 'center'} }>
<h2>Salticam Detector Mode</h2>
<table className='stat-table'>
<thead>
<tr>
Expand Down
3 changes: 1 addition & 2 deletions src/styles/components/plots.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,4 @@ circle.optional.target {
font: 10px sans-serif;
background: yellow;
box-shadow: 2px 2px 1px #888;

}
}
4 changes: 4 additions & 0 deletions src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ export const UPDATE_ALLOCATED_PRIORITY = 'UPDATE_ALLOCATED_PRIORITY'

export const LIAISON_SELECTED = 'LIAISON_SELECTED'

export const FETCH_PARTNER_STATISTICS_PASS = 'FETCH_PARTNER_STATISTICS_PASS'
export const FETCH_PARTNER_STATISTICS_START = 'FETCH_PARTNER_STATISTICS_START'
export const FETCH_PARTNER_STATISTICS_FAIL = 'FETCH_PARTNER_STATISTICS_FAIL'

export const badTime = {
color: 'black',
background:'#FF6060'
Expand Down
Loading