From 9fec28b758f88afebf8aa543aba09514328685df Mon Sep 17 00:00:00 2001
From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br>
Date: Wed, 5 Aug 2020 16:36:46 -0300
Subject: [PATCH 1/3] Added QA to filter

---
 __tests__/__snapshots__/index.js.snap | 1 +
 src/utils/challenge/filter.js         | 9 +++++++--
 src/utils/tc.js                       | 1 +
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/__tests__/__snapshots__/index.js.snap b/__tests__/__snapshots__/index.js.snap
index f1c7c70a..74951666 100644
--- a/__tests__/__snapshots__/index.js.snap
+++ b/__tests__/__snapshots__/index.js.snap
@@ -375,6 +375,7 @@ Object {
       "DATA_SCIENCE": "data_science",
       "DESIGN": "design",
       "DEVELOP": "develop",
+      "QA": "qa",
     },
     "REVIEW_OPPORTUNITY_TYPES": Object {
       "Contest Review": "Review",
diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js
index d9e6429e..ff0c672e 100644
--- a/src/utils/challenge/filter.js
+++ b/src/utils/challenge/filter.js
@@ -160,13 +160,18 @@ function filterByText(challenge, state) {
 function filterByTrack(challenge, state) {
   if (!state.tracks) return true;
 
-  /* Development challenges having Data Science tech tag, still should be
-   * included into data science track. */
+  /* Development challenges having Data Science and QA tech tag, still should be
+   * included into data science and qa tracks. */
   if (state.tracks[COMPETITION_TRACKS.DATA_SCIENCE]
     && _.includes(challenge.tags, 'Data Science')) {
     return true;
   }
 
+  if (state.tracks[COMPETITION_TRACKS.QA]
+    && _.includes(challenge.tags, 'QA')) {
+    return true;
+  }
+
   return _.keys(state.tracks).some(track => challenge.communities.has(track));
 }
 
diff --git a/src/utils/tc.js b/src/utils/tc.js
index aed187ca..4cbf115e 100644
--- a/src/utils/tc.js
+++ b/src/utils/tc.js
@@ -14,6 +14,7 @@ export const COMPETITION_TRACKS = {
   DATA_SCIENCE: 'data_science',
   DESIGN: 'design',
   DEVELOP: 'develop',
+  QA: 'qa',
 };
 
 /**

From b58fd0cfc2df2fa751e6dd031d9bf38f0fa24055 Mon Sep 17 00:00:00 2001
From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br>
Date: Wed, 5 Aug 2020 20:34:58 -0300
Subject: [PATCH 2/3] Updated challengeSubtracks to challengeTypes in filter

---
 __tests__/__snapshots__/index.js.snap |  2 +-
 __tests__/utils/challenge/filter.js   | 12 +++++------
 docs/challenge.filter.md              | 10 ++++-----
 src/utils/challenge/filter.js         | 29 +++++++++++++--------------
 4 files changed, 26 insertions(+), 27 deletions(-)

diff --git a/__tests__/__snapshots__/index.js.snap b/__tests__/__snapshots__/index.js.snap
index 74951666..8206f48c 100644
--- a/__tests__/__snapshots__/index.js.snap
+++ b/__tests__/__snapshots__/index.js.snap
@@ -225,9 +225,9 @@ Object {
       "setEndDate": [Function],
       "setReviewOpportunityType": [Function],
       "setStartDate": [Function],
-      "setSubtracks": [Function],
       "setTags": [Function],
       "setText": [Function],
+      "setTypes": [Function],
     },
   },
   "errors": Object {
diff --git a/__tests__/utils/challenge/filter.js b/__tests__/utils/challenge/filter.js
index 950a1ca9..01a4753b 100644
--- a/__tests__/utils/challenge/filter.js
+++ b/__tests__/utils/challenge/filter.js
@@ -1,5 +1,5 @@
 import {
-  setText, setTags, setSubtracks, setStartDate,
+  setText, setTags, setTypes, setStartDate,
 } from '../../../src/utils/challenge/filter';
 
 describe('challenge filter', () => {
@@ -22,12 +22,12 @@ describe('challenge filter', () => {
     expect(res).toEqual({});
   });
 
-  test('setSubtracks', () => {
-    res = setSubtracks({});
+  test('setTypes', () => {
+    res = setTypes({});
     expect(res).toEqual({});
-    res = setSubtracks({}, 'subtracks');
-    expect(res).toEqual({ subtracks: 'subtracks' });
-    res = setSubtracks({ subtracks: 'subtracks' });
+    res = setTypes({}, 'types');
+    expect(res).toEqual({ types: 'types' });
+    res = setTypes({ types: 'types' });
     expect(res).toEqual({});
   });
 
diff --git a/docs/challenge.filter.md b/docs/challenge.filter.md
index 978050ee..391ef5e5 100644
--- a/docs/challenge.filter.md
+++ b/docs/challenge.filter.md
@@ -70,7 +70,7 @@ users are participating.
         * [.setEndDate(state, date)](#module_challenge.filter.setEndDate) ⇒ <code>Object</code>
         * [.setReviewOpportunityType(state, reviewOpportunityType)](#module_challenge.filter.setReviewOpportunityType) ⇒ <code>Object</code>
         * [.setStartDate(state, date)](#module_challenge.filter.setStartDate) ⇒ <code>Object</code>
-        * [.setSubtracks(state, subtracks)](#module_challenge.filter.setSubtracks) ⇒ <code>Object</code>
+        * [.setTypes(state, types)](#module_challenge.filter.setTypes) ⇒ <code>Object</code>
         * [.setTags(state, tags)](#module_challenge.filter.setTags) ⇒ <code>Object</code>
         * [.setText(state, text)](#module_challenge.filter.setText) ⇒ <code>Object</code>
     * _inner_
@@ -198,17 +198,17 @@ Clones the state and sets the start date.
 | state | <code>Object</code> |  |
 | date | <code>String</code> | ISO date string. |
 
-<a name="module_challenge.filter.setSubtracks"></a>
+<a name="module_challenge.filter.setTypes"></a>
 
-### challenge.filter.setSubtracks(state, subtracks) ⇒ <code>Object</code>
-Clones the state and sets the subtracks.
+### challenge.filter.setTypes(state, types) ⇒ <code>Object</code>
+Clones the state and sets the challenge types.
 
 **Kind**: static method of [<code>challenge.filter</code>](#module_challenge.filter)  
 
 | Param | Type |
 | --- | --- |
 | state | <code>Object</code> | 
-| subtracks | <code>Array</code> | 
+| types | <code>Array</code> | 
 
 <a name="module_challenge.filter.setTags"></a>
 
diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js
index ff0c672e..778a6595 100644
--- a/src/utils/challenge/filter.js
+++ b/src/utils/challenge/filter.js
@@ -175,9 +175,9 @@ function filterByTrack(challenge, state) {
   return _.keys(state.tracks).some(track => challenge.communities.has(track));
 }
 
-function filterBySubtracks(challenge, state) {
-  if (!state.subtracks) return true;
-  return state.subtracks.includes(challenge.typeId);
+function filterByTypes(challenge, state) {
+  if (!state.types) return true;
+  return state.types.includes(challenge.typeId);
 }
 
 function filterByUpcoming(challenge, state) {
@@ -227,7 +227,7 @@ export function getFilterFunction(state) {
       && filterByGroupIds(challenge, state)
       && filterByText(challenge, state)
       && filterByTags(challenge, state)
-      && filterBySubtracks(challenge, state)
+      && filterByTypes(challenge, state)
       && filterByUsers(challenge, state)
       && filterByEndDate(challenge, state)
       && filterByStartDate(challenge, state)
@@ -250,9 +250,9 @@ export function getFilterFunction(state) {
  * @param {Object} state
  * @return {Function}
  */
-export function getReviewOpportunitiesFilterFunction(state, validSubtracks) {
+export function getReviewOpportunitiesFilterFunction(state, validTypes) {
   return (opp) => {
-    const newSubTrack = _.find(validSubtracks, { abbreviation: opp.challenge.subTrack }) || {};
+    const newType = _.find(validTypes, { name: opp.challenge.type }) || {};
 
     // Review Opportunity objects have a challenge field which
     // is largely compatible with many of the existing filter functions
@@ -262,12 +262,11 @@ export function getReviewOpportunitiesFilterFunction(state, validSubtracks) {
       // This allows filterByText to search for Review Types and Challenge Titles
       name: `${opp.challenge.title} ${REVIEW_OPPORTUNITY_TYPES[opp.type]}`,
       registrationStartDate: opp.startDate, // startDate of Review, not Challenge
-      subTrack: opp.challenge.subTrack || '', // Sometimes back-end doesn't return this field
       submissionEndDate: opp.startDate, // Currently uses startDate for both date comparisons
       communities: new Set([ // Used to filter by Track, and communities at a future date
         opp.challenge.track.toLowerCase(),
       ]),
-      typeId: newSubTrack.id,
+      typeId: newType.id,
       tags: opp.challenge.technologies || [],
       platforms: opp.challenge.platforms || [],
     };
@@ -276,7 +275,7 @@ export function getReviewOpportunitiesFilterFunction(state, validSubtracks) {
       filterByTrack(challenge, state)
       && filterByText(challenge, state)
       && filterByTags(challenge, state)
-      && filterBySubtracks(challenge, state)
+      && filterByTypes(challenge, state)
       && filterByEndDate(challenge, state)
       && filterByStartDate(challenge, state)
       && filterByReviewOpportunityType(opp, state)
@@ -460,16 +459,16 @@ export function setStartDate(state, date) {
 }
 
 /**
- * Clones the state and sets the subtracks.
+ * Clones the state and sets the challenge types.
  * @param {Object} state
- * @param {Array} subtracks
+ * @param {Array} types
  * @return {Object}
  */
-export function setSubtracks(state, subtracks) {
-  if (subtracks && subtracks.length) return { ...state, subtracks };
-  if (!state.subtracks) return state;
+export function setTypes(state, types) {
+  if (types && types.length) return { ...state, types };
+  if (!state.types) return state;
   const res = _.clone(state);
-  delete res.subtracks;
+  delete res.types;
   return res;
 }
 

From d16b2ba0ff0feb1aa015ebbe2f1449e0a9cc744b Mon Sep 17 00:00:00 2001
From: "Luiz R. Rodrigues" <contato@luizrrodrigues.com.br>
Date: Thu, 6 Aug 2020 00:06:00 -0300
Subject: [PATCH 3/3] Update to use new challenge.track name + added QA

---
 __tests__/__snapshots__/index.js.snap |  8 ++++----
 src/utils/challenge/filter.js         | 15 +--------------
 src/utils/tc.js                       |  8 ++++----
 3 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/__tests__/__snapshots__/index.js.snap b/__tests__/__snapshots__/index.js.snap
index 8206f48c..53d2317a 100644
--- a/__tests__/__snapshots__/index.js.snap
+++ b/__tests__/__snapshots__/index.js.snap
@@ -372,10 +372,10 @@ Object {
   },
   "tc": Object {
     "COMPETITION_TRACKS": Object {
-      "DATA_SCIENCE": "data_science",
-      "DESIGN": "design",
-      "DEVELOP": "develop",
-      "QA": "qa",
+      "DATA_SCIENCE": "Data Science",
+      "DESIGN": "Design",
+      "DEVELOP": "Development",
+      "QA": "Quality Assurance",
     },
     "REVIEW_OPPORTUNITY_TYPES": Object {
       "Contest Review": "Review",
diff --git a/src/utils/challenge/filter.js b/src/utils/challenge/filter.js
index 778a6595..e7aebf8d 100644
--- a/src/utils/challenge/filter.js
+++ b/src/utils/challenge/filter.js
@@ -159,20 +159,7 @@ function filterByText(challenge, state) {
 
 function filterByTrack(challenge, state) {
   if (!state.tracks) return true;
-
-  /* Development challenges having Data Science and QA tech tag, still should be
-   * included into data science and qa tracks. */
-  if (state.tracks[COMPETITION_TRACKS.DATA_SCIENCE]
-    && _.includes(challenge.tags, 'Data Science')) {
-    return true;
-  }
-
-  if (state.tracks[COMPETITION_TRACKS.QA]
-    && _.includes(challenge.tags, 'QA')) {
-    return true;
-  }
-
-  return _.keys(state.tracks).some(track => challenge.communities.has(track));
+  return _.keys(state.tracks).some(track => challenge.track === track);
 }
 
 function filterByTypes(challenge, state) {
diff --git a/src/utils/tc.js b/src/utils/tc.js
index 4cbf115e..5388d4bb 100644
--- a/src/utils/tc.js
+++ b/src/utils/tc.js
@@ -11,10 +11,10 @@
  * uses upper-case literals to encode the tracks. At some point, we should
  * update it in this code as well! */
 export const COMPETITION_TRACKS = {
-  DATA_SCIENCE: 'data_science',
-  DESIGN: 'design',
-  DEVELOP: 'develop',
-  QA: 'qa',
+  DATA_SCIENCE: 'Data Science',
+  DESIGN: 'Design',
+  DEVELOP: 'Development',
+  QA: 'Quality Assurance',
 };
 
 /**