Skip to content

Commit

Permalink
fixing bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tfhuhtal committed Oct 3, 2024
1 parent 8cea1a8 commit 2328eb7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ const Answer = ({ question, faculty }) => {
const facultyAnswers = useMemo(() => {
return answers ? answers.find(answer => answer.programme === faculty)?.data || {} : {}
}, [answers, faculty])
const [showAll, setShowAll] = useState(false)
const fieldName = `${question.id}_lights_history`
const modalName = `${question.id}_modal`
const dataFromRedux = useSelector(({ form }) => form.data)
const lightsHistory = dataFromRedux[fieldName] || []
const displayedHistory = showAll ? lightsHistory : lightsHistory.slice(Math.max(lightsHistory.length - 4, 0))
const viewOnly = useSelector(({ form }) => form.viewOnly)
const isEditable = !viewOnly

Expand Down Expand Up @@ -117,10 +115,10 @@ const Answer = ({ question, faculty }) => {
<div>
<i>{t(`formView:monitoringTrackingLabel`)}</i>
<div className="light-container">
{displayedHistory.length > 0 ? (
{lightsHistory.length > 0 ? (
<>
{displayedHistory.map(entry => (
<div className="light" key={entry.date}>
{lightsHistory.map((entry, index) => (
<div data-cy={`${entry.color}-${index}`} className="light" key={entry.date}>
<span className={`answer-circle-big-${entry.color}`} />
<div className="light-text">
<span>{t(`common:${entry.color}Faculty`)}</span>
Expand All @@ -129,11 +127,11 @@ const Answer = ({ question, faculty }) => {
</div>
</div>
))}
{lightsHistory.length > 4 && (
{/* lightsHistory.length > 4 && (
<Button onClick={() => setShowAll(!showAll)} style={{ marginTop: '10px' }}>
{showAll ? t('common:showLess') : t('common:showAll')}
</Button>
)}
) */}
</>
) : (
t('formView:noAnswer')
Expand Down
3 changes: 2 additions & 1 deletion client/components/ReportPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ export default () => {
questionsList = questionsList.filter(q => {
if (filters.level === 'doctoral') {
return q.id.startsWith('T')
} else if (filters.level !== 'allProgrammes') {
}
if (filters.level !== 'allProgrammes') {
return !q.id.startsWith('T')
}
return true
Expand Down
10 changes: 7 additions & 3 deletions cypress/integration/trackingpage.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ describe('Tracking page tests', () => {

cy.get('[data-cy=questions-list-0]').click()

cy.contains('1. Degree programmes include model schedules in curricula that support understanding of the education system, study paths, and course offerings').click()
cy.contains(
'1. Degree programmes include model schedules in curricula that support understanding of the education system, study paths, and course offerings',
).click()
cy.get('[data-cy=send-selection-button]').click()
})

Expand All @@ -27,7 +29,9 @@ describe('Tracking page tests', () => {

cy.get('[data-cy=questions-list-0]').click()

cy.contains('1. Degree programmes include model schedules in curricula that support understanding of the education system, study paths, and course offerings').click()
cy.contains(
'1. Degree programmes include model schedules in curricula that support understanding of the education system, study paths, and course offerings',
).click()
cy.get('[data-cy=send-selection-button]').click()

cy.get('[data-cy=accordion-group-0]').click()
Expand Down Expand Up @@ -89,4 +93,4 @@ describe('Tracking page tests', () => {
cy.get(`[data-cy=square-${testFacultyCode}-1]`).click()
cy.contains('01.01.2000').should('exist')
})
})
})

0 comments on commit 2328eb7

Please sign in to comment.