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 all 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
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@sentry/react": "^6.19.7",
"@sentry/tracing": "^6.19.7",
"@types/react-csv": "^1.1.1",
"apollo-cache-inmemory": "^1.0.0",
"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 +28,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 @@ -56,7 +58,7 @@
"start": "REACT_APP_API_BASE_URL=http://tacapidev.cape.saao.ac.za react-app-rewired start",
"start2": "REACT_APP_API_BASE_URL=http://tac.salt.ac.za react-app-rewired start",
"dev": "REACT_APP_SALT_SERVER_API_URL=http://127.0.0.1:5000 REACT_APP_API_BASE_URL=http://127.0.0.1:5001 react-app-rewired start",
"build": "REACT_APP_API_BASE_URL=http://saltapi.salt.ac.za react-app-rewired build",
"build": "REACT_APP_API_BASE_URL=http://saltapi.salt.ac.za react-app-rewired build REACT_APP_SENTRY_DSN=https://[email protected]/5913441",
"build-dev": "REACT_APP_API_BASE_URL=http://tacapidev.cape.saao.ac.za react-app-rewired build",
"test": "REACT_APP_API_BASE_URL=http://test; react-app-rewired test --env=jsdom",
"eject": "react-scripts eject",
Expand All @@ -67,16 +69,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))
})
}
}
}
26 changes: 15 additions & 11 deletions src/api/graphQL.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { graphqlClient, saltServerApiClient } from './index'
import {getTechReportFields} from '../util'
import {getTechReportFields, logStacktrace} from '../util'
import { isNewProposal, isLongTermProposal } from '../util/proposal'
import {convertPartnerAllocations} from '../actions/timeAllocationActions'

Expand Down Expand Up @@ -363,17 +363,17 @@ export function queryStatistics (semester, partner) {
observingConditions{
seeing{
timeRequested{
lessEqual1Dot5
lessEqual2
lessEqual2Dot5
lessEqual3
between0And1Dot5
between1Dot5And2
between2And2Dot5
between2Dot5And3
moreThan3
}
numberOfProposals{
lessEqual1Dot5
lessEqual2
lessEqual2Dot5
lessEqual3
between0And1Dot5
between1Dot5And2
between2And2Dot5
between2Dot5And3
moreThan3
}
}
Expand Down Expand Up @@ -428,7 +428,9 @@ export function queryStatistics (semester, partner) {
return graphqlClient().post('/graphql', { query })
.then(
response => response.data.data.statistics
)
).catch((e) => {
logStacktrace(e)
})
}

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

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
Loading