diff --git a/examples/nuxt-app/test/features/search-listing/grants.feature b/examples/nuxt-app/test/features/search-listing/grants.feature index b03dc7ac4c..5bc320d898 100644 --- a/examples/nuxt-app/test/features/search-listing/grants.feature +++ b/examples/nuxt-app/test/features/search-listing/grants.feature @@ -13,14 +13,16 @@ Feature: Grants collection And the search network request is stubbed with fixture "/search-listing/grants/response" and status 200 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" When I visit the page "/grants" - Then the search listing page should have 3 results + Then the search listing page should have 5 results And the search listing layout should be "list" And the search network request should be called with the "/search-listing/grants/request" fixture And the grant search listing results should have following items: - | title | url | updated | content | audience | amount | status | - | THIS IS A TEST | /tc-9b-grant-page-closed | Updated: 9 May 2023 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam tincidunt sit amet ligula sit amet lacinia. In a leo nec tortor aliquet faucibus. | Business | $11,326 - $26,494 | Closed | - | TC-9a Grant Simple Test - Date Range | /tc-9a-grant-simple-test-date-range | Updated: 9 May 2023 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam tincidunt sit amet ligula sit amet lacinia. In a leo nec tortor aliquet faucibus. | Not-for-profit groups, government | $11,326 - $26,494 | Open, closing in 163 days | - | 2023 Coastcare Victoria Community Grants | https://www.marineandcoasts.vic.gov.au/coastcare-victoria-community-grants | Updated: 8 March 2023 | This year, Coastcare Victoria has $210,000 available for grants of up to $10,000 each. Projects will fit into one of three streams on offer including | Who can apply:Individuals, not-for-profit groups | $1 - $10,000 | Closed | + | title | url | content | audience | amount | status | + | THIS IS A TEST | /tc-9b-grant-page-closed | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam tincidunt sit amet ligula sit amet lacinia. In a leo nec tortor aliquet faucibus. | Business | $11,326 - $26,494 | Closed | + | TC-9a Grant Simple Test - Date Range | /tc-9a-grant-simple-test-date-range | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam tincidunt sit amet ligula sit amet lacinia. In a leo nec tortor aliquet faucibus. | Not-for-profit groups, government | $11,326 - $26,494 | Open, closes 16 July 2050 | + | 2023 Coastcare Victoria Community Grants | https://www.marineandcoasts.vic.gov.au/coastcare-victoria-community-grants | This year, Coastcare Victoria has $210,000 available for grants of up to $10,000 each. Projects will fit into one of three streams on offer including | Who can apply:Individuals, not-for-profit groups | $1 - $10,000 | Closed | + | Opening soon test | /opening-soon-test | Supporting schools to build strong VCE Vocational Major and Victorian Pathways Certificate delivery | Government schools | $0 - $30,000 | Opens 16 April 2050 | + | Youth Access Initiative | /youth-access-initiative | The Youth Access Initiative provides young people who have care and/or youth justice experience or who are residing in Education First Youth Foyers | Individuals | | Ongoing | @mockserver Example: Grant status filter - Open @@ -28,7 +30,7 @@ Feature: Grants collection And the search network request is stubbed with fixture "/search-listing/grants/response" and status 200 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" When I visit the page "/grants?status=open" - Then the search listing page should have 3 results + Then the search listing page should have 5 results And the search network request should be called with the "/search-listing/grants/request-status-open" fixture @mockserver @@ -37,7 +39,7 @@ Feature: Grants collection And the search network request is stubbed with fixture "/search-listing/grants/response" and status 200 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" When I visit the page "/grants?status=closed" - Then the search listing page should have 3 results + Then the search listing page should have 5 results And the search network request should be called with the "/search-listing/grants/request-status-closed" fixture @mockserver @@ -46,7 +48,7 @@ Feature: Grants collection And the search network request is stubbed with fixture "/search-listing/grants/response" and status 200 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" When I visit the page "/grants?status=ongoing" - Then the search listing page should have 3 results + Then the search listing page should have 5 results And the search network request should be called with the "/search-listing/grants/request-status-ongoing" fixture @mockserver @@ -55,5 +57,5 @@ Feature: Grants collection And the search network request is stubbed with fixture "/search-listing/grants/response" and status 200 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" When I visit the page "/grants?status=opening_soon" - Then the search listing page should have 3 results + Then the search listing page should have 5 results And the search network request should be called with the "/search-listing/grants/request-status-opening-soon" fixture diff --git a/examples/nuxt-app/test/fixtures/search-listing/grants/request-status-open.json b/examples/nuxt-app/test/fixtures/search-listing/grants/request-status-open.json index b1c77c3036..9eb86b728d 100644 --- a/examples/nuxt-app/test/fixtures/search-listing/grants/request-status-open.json +++ b/examples/nuxt-app/test/fixtures/search-listing/grants/request-status-open.json @@ -25,6 +25,13 @@ } } } + ], + "must_not": [ + { + "term": { + "field_node_on_going": "true" + } + } ] } } diff --git a/examples/nuxt-app/test/fixtures/search-listing/grants/response.json b/examples/nuxt-app/test/fixtures/search-listing/grants/response.json index 72bc534e8e..94b64ffa15 100644 --- a/examples/nuxt-app/test/fixtures/search-listing/grants/response.json +++ b/examples/nuxt-app/test/fixtures/search-listing/grants/response.json @@ -9,7 +9,7 @@ }, "hits": { "total": { - "value": 2, + "value": 5, "relation": "eq" }, "max_score": null, @@ -184,6 +184,87 @@ "uuid": ["e8022205-e15f-4231-ac38-49ed14328823"] }, "sort": [1.0, 3522] + }, + { + "_index": "a83890f7a31dea14e1ae83c6f0afacca--elasticsearch_index_develop_node", + "_id": "entity:node/45297:en", + "_score": 2.0, + "_source": { + "_language": "en", + "node_grants": ["node_access_all:0"], + "url": ["/site-4/opening-soon-test"], + "changed": ["2024-12-13T15:03:02+11:00"], + "created": ["2024-12-13T15:01:54+11:00"], + "field_audience": [2128], + "field_audience_name": ["Government schools"], + "field_audience_uuid": ["b753188a-fa7c-4252-bc5e-3d60d242a36d"], + "field_content_category": [1317], + "field_content_category_name": ["Program"], + "field_landing_page_intro_text": [ + "Supporting schools to build strong VCE Vocational Major and Victorian Pathways Certificate delivery" + ], + "field_landing_page_summary": [ + "Supporting schools to build strong VCE Vocational Major and Victorian Pathways Certificate delivery" + ], + "field_node_dates_end_value": ["2050-12-16T00:00:00+10:00"], + "field_node_dates_start_value": ["2050-04-16T18:00:00+10:00"], + "field_node_on_going": [false], + "field_node_primary_csite": [4], + "field_node_site": [4, 842], + "field_topic": [10], + "field_topic_name": ["Education"], + "field_topic_path": ["/topic/education"], + "field_topic_uuid": ["3764c1dc-9475-43cc-a483-96bec239c4f7"], + "funding_level_from": [0], + "funding_level_to": [30000], + "langcode": ["en"], + "nid": [45297], + "status": [true], + "title": ["Opening soon test"], + "type": ["grant"], + "uid": [11836], + "uuid": ["f46e3c08-3dc5-4791-8494-9d3d6955441c"] + }, + "sort": [2.0, 1798549200000, "Opening soon test"] + }, + { + "_index": "a83890f7a31dea14e1ae83c6f0afacca--elasticsearch_index_production_node", + "_id": "entity:node/24378:en", + "_score": 1.0, + "_source": { + "_language": "en", + "node_grants": ["node_access_all:0"], + "url": ["/site-4/youth-access-initiative"], + "changed": ["2023-09-28T15:52:24+10:00"], + "created": ["2022-03-28T16:47:53+11:00"], + "field_audience": [80], + "field_audience_name": ["Individual"], + "field_audience_uuid": ["f86a3a17-380b-4840-8d54-195260ac9db1"], + "field_content_category": [1318, 1317], + "field_content_category_name": ["Initiative", "Program"], + "field_landing_page_contact_name": ["The Skills First team"], + "field_landing_page_intro_text": [ + "The Youth Access Initiative provides young people who have care and/or youth justice experience or who are residing in Education First Youth Foyers with access to vocational education and training opportunities through a tuition fee waiver." + ], + "field_landing_page_summary": [ + "The Youth Access Initiative provides young people who have care and/or youth justice experience or who are residing in Education First Youth Foyers with access to vocational education and training opportunities through a tuition fee waiver." + ], + "field_node_on_going": [true], + "field_node_primary_csite": [4], + "field_node_site": [1036, 4], + "field_topic": [10], + "field_topic_name": ["Education"], + "field_topic_path": ["/topic/education"], + "field_topic_uuid": ["3764c1dc-9475-43cc-a483-96bec239c4f7"], + "langcode": ["en"], + "nid": [24378], + "status": [true], + "title": ["Youth Access Initiative"], + "type": ["grant"], + "uid": [9920], + "uuid": ["a9b548ec-f44b-48eb-8407-21cf7e6ef4ed"] + }, + "sort": [1.0, "Youth Access Initiative"] } ] }, diff --git a/packages/ripple-test-utils/step_definitions/content-types/grant.ts b/packages/ripple-test-utils/step_definitions/content-types/grant.ts index 38d80b0e0c..9e3125e267 100644 --- a/packages/ripple-test-utils/step_definitions/content-types/grant.ts +++ b/packages/ripple-test-utils/step_definitions/content-types/grant.ts @@ -81,7 +81,9 @@ Then( cy.get('@meta').should('contain', row.amount) cy.get('@meta').should('contain', row.status) cy.get('@item').should('contain', row.content) - cy.get('@item').should('contain', row.updated) + if (row.updated) { + cy.get('@item').should('contain', row.updated) + } }) }) } diff --git a/packages/ripple-tide-grant/app.config.ts b/packages/ripple-tide-grant/app.config.ts index 9362a80db2..e23951507c 100644 --- a/packages/ripple-tide-grant/app.config.ts +++ b/packages/ripple-tide-grant/app.config.ts @@ -23,6 +23,13 @@ export default defineAppConfig({ } } } + ], + must_not: [ + { + term: { + field_node_on_going: 'true' + } + } ] } } @@ -65,6 +72,96 @@ export default defineAppConfig({ } } } + }, + queryConfigFunctions: { + grantsQueryFn: ({ queryFilters, searchTerm }) => { + const searchQuery = searchTerm?.q + ? { + multi_match: { + query: searchTerm?.q, + fields: [ + 'title^3', + 'field_landing_page_summary^2', + 'body', + 'field_paragraph_body', + 'summary_processed' + ] + } + } + : [{ match_all: {} }] + + const rangeQuery = [ + { + range: { + field_node_dates_start_value: { + lte: 'now' + } + } + }, + { + range: { + field_node_dates_end_value: { + gte: 'now' + } + } + } + ] + + return { + function_score: { + query: { + bool: { + must: searchQuery, + filter: queryFilters + } + }, + functions: [ + { + filter: { + bool: { + must: [ + ...rangeQuery, + { term: { field_node_on_going: false } } + ] + } + }, + weight: 4 + }, + { + filter: { + bool: { + must: [...rangeQuery], + must_not: [{ exists: { field: 'field_node_on_going' } }] + } + }, + weight: 4 + }, + { + filter: [ + { + term: { field_node_on_going: true } + } + ], + weight: 3 + }, + { + filter: [ + { + range: { + field_node_dates_start_value: { + gte: 'now' + } + } + } + ], + weight: 2 + } + ], + score_mode: 'sum', + boost_mode: 'multiply' + } + } + } } } } diff --git a/packages/ripple-tide-grant/components/TideGrantMeta.vue b/packages/ripple-tide-grant/components/TideGrantMeta.vue index bb04ed0cf6..c32896dfa3 100644 --- a/packages/ripple-tide-grant/components/TideGrantMeta.vue +++ b/packages/ripple-tide-grant/components/TideGrantMeta.vue @@ -31,6 +31,29 @@ const grantStatus = computed(() => { const overviewList = computed(() => { let list: any[] = [] + const icons = { + open: { + name: 'icon-check-circle-filled', + color: 'success' + }, + closed: { + name: 'icon-cancel-circle-filled', + color: 'error' + }, + opening_soon: { + name: 'icon-clock-circle-filled', + color: 'warning' + } + } + + list.push({ + term: 'Status:', + description: grantStatus.value.displayLabel, + iconName: + icons[grantStatus.value.status]?.name || 'icon-info-circle-filled', + iconColour: icons[grantStatus.value.status]?.color || 'default' + }) + if (props.audience) { list.push({ term: 'Who can apply:', @@ -39,17 +62,6 @@ const overviewList = computed(() => { }) } - const open = - grantStatus.value.status === 'open' || - grantStatus.value.status === 'opening_soon' - - list.push({ - term: 'Status:', - description: grantStatus.value.displayLabel, - iconName: open ? 'icon-check-circle-filled' : 'icon-cancel-circle-filled', - iconColour: open ? 'success' : 'error' - }) - if (props.funding) { list.push({ term: 'Funding:', diff --git a/packages/ripple-tide-grant/components/global/TideGrantSearchResult.vue b/packages/ripple-tide-grant/components/global/TideGrantSearchResult.vue index 5fa75fe2ae..bcb9910635 100644 --- a/packages/ripple-tide-grant/components/global/TideGrantSearchResult.vue +++ b/packages/ripple-tide-grant/components/global/TideGrantSearchResult.vue @@ -54,7 +54,6 @@ const link = computed(() => { :title="title" :url="link" :content="summary" - :updated="updated" >