Skip to content

Commit

Permalink
fix: Filter jobs based on job source attribute.
Browse files Browse the repository at this point in the history
Job in algolia either originate from course skills data or industry skills data. We want to ignore jobs that ignore from industry skills data at some places on the UI. This PR takes care of that.
  • Loading branch information
saleem-latif committed Jul 13, 2023
1 parent 11d2acb commit 2712540
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/components/my-career/SearchJobRole.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import React, { useContext, useState } from 'react';
import PropTypes from 'prop-types';
import { getConfig } from '@edx/frontend-platform/config';
import { logError } from '@edx/frontend-platform/logging';
import { InstantSearch } from 'react-instantsearch-dom';
import { Configure, InstantSearch } from 'react-instantsearch-dom';
import { SearchContext, deleteRefinementAction } from '@edx/frontend-enterprise-catalog-search';
import { getAuthenticatedUser } from '@edx/frontend-platform/auth';
import FacetListRefinement from '@edx/frontend-enterprise-catalog-search/FacetListRefinement';
import { camelCaseObject } from '@edx/frontend-platform/utils';
import {
Button, Form, StatefulButton,
} from '@edx/paragon';
import { CURRENT_JOB_FACET } from '../skills-quiz/constants';
import { CURRENT_JOB_FACET , JOB_FILTERS } from '../skills-quiz/constants';
import { patchProfile, fetchJobDetailsFromAlgolia } from './data/service';
import { CURRENT_JOB_PROFILE_FIELD_NAME, SAVE_BUTTON_LABELS } from './data/constants';
import { useAlgoliaSearch } from '../../utils/hooks';
Expand Down Expand Up @@ -90,6 +90,10 @@ const SearchJobRole = (props) => {
searchClient={searchClient}
>
<p> Search for your job role </p>
<Configure
facetingAfterDistinct
filters={JOB_FILTERS.JOB_SOURCE_COURSE_SKILL}
/>
<FacetListRefinement
id="current-job-dropdown"
key={attribute}
Expand Down
2 changes: 1 addition & 1 deletion src/components/search/data/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const useDefaultSearchFilters = ({
return getCatalogString(searchCatalogs);
}

// If the learner is not confined to certain catalogs, scope to all of the enterprise's catalogs
// If the learner is not confined to certain catalogs, scope to all of enterprise's catalogs
return `enterprise_customer_uuids:${enterpriseConfig.uuid}`;
},
[enterpriseConfig.uuid, searchCatalogs, showAllRefinement],
Expand Down
2 changes: 2 additions & 0 deletions src/components/skills-quiz/SearchJobCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { SearchContext } from '@edx/frontend-enterprise-catalog-search';
import { SkillsContext } from './SkillsContextProvider';
import { SET_KEY_VALUE } from './data/constants';
import JobCardComponent from './JobCardComponent';
import { JOB_FILTERS } from './constants';

const SearchJobCard = ({ index }) => {
const { refinements } = useContext(SearchContext);
Expand Down Expand Up @@ -37,6 +38,7 @@ const SearchJobCard = ({ index }) => {
async function fetchJobs() {
setIsLoading(true);
const { hits } = await index.search('', {
filters: JOB_FILTERS.JOB_SOURCE_COURSE_SKILL,
facetFilters: [
jobsToFetch,
],
Expand Down
8 changes: 8 additions & 0 deletions src/components/skills-quiz/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,11 @@ export const HITS_PER_PAGE = 500;
export const LOADING_NO_OF_CARDS = 9;

export const JOB_DESCRIPTION_DISCLAIMER = 'This job description has been created by an artificial intelligence, and should be reviewed carefully.';

export const JOB_SOURCE_COURSE_SKILL = 'course_skill';
export const JOB_SOURCE_INDUSTRY = 'industry';

export const JOB_FILTERS = {
JOB_SOURCE_COURSE_SKILL: `job_sources:${JOB_SOURCE_COURSE_SKILL}`,
JOB_SOURCE_INDUSTRY: `job_sources:${JOB_SOURCE_INDUSTRY}`,
};

0 comments on commit 2712540

Please sign in to comment.