-
Notifications
You must be signed in to change notification settings - Fork 6
Remove higher-level topics from GCSE Maths Question Finder #1802
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
Conversation
I'm introducing these tests because we plan to exclude some of these from the GCSE Maths question finder.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1802 +/- ##
==========================================
+ Coverage 41.56% 41.66% +0.10%
==========================================
Files 543 543
Lines 23784 23828 +44
Branches 7863 7035 -828
==========================================
+ Hits 9885 9928 +43
- Misses 13256 13857 +601
+ Partials 643 43 -600 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f3a69f8 to
7e60d12
Compare
This is for consistency with `questionSearch`'s behaviour on the main question finder, where the first element of the returned array is also the list of available subjects. This unifies the structure of the return value, even though context-specific questions finders never actually use the first element.
6cef506 to
779e1d0
Compare
This is implemented with a potential extension in mind. If, in the future, we'd like to hide more fields or topics, depending on whether there are any available questions for the context, we can just change the backend to return the list of available tags for the context, and change getAllowedTags to return these.
axlewin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works well, and fundamentally it would be fine to merge as-is. I agree that we should be aiming to make this compatible with some further improvements in the future, and it's nice to have some test coverage for this (fairly complicated) behaviour.
I'm not sure that the hardcoded exclusions list is in the most sensible place; I've tried to justify my thoughts in the comment, but let me know if you disagree.
I've also got some questions about the way the list of topics is handled in the tests, but admittedly I'm not sure that I understand the structure of these tests properly, so I might be completely wrong with my comments there.
| export enum Filter { | ||
| // stages | ||
| All = 'All', | ||
| GCSE = 'GCSE', | ||
|
|
||
| //subjects | ||
| Physics = "Physics", | ||
| Skills = "Skills", | ||
| Maths = "Maths", | ||
|
|
||
| // Physics fields | ||
| Mechanics = "Mechanics", | ||
| Skills = "Skills", | ||
|
|
||
| // Physics -> Mechanics topics | ||
| Statics = "Statics", | ||
| Kinematics = `Kine${softHyphen}matics`, | ||
| Dynamics = "Dynamics", | ||
| CircularMotion = "Circular Motion", | ||
| Oscillations = `Oscil${softHyphen}lations`, | ||
| Materials = "Materials", | ||
|
|
||
| // Physics -> Skills topics | ||
| SigFigs = "Significant Figures", | ||
| Maths = "Maths", | ||
| Units = "Units", | ||
|
|
||
| // Maths fields | ||
| Number = "Number", | ||
| Arithmetic = "Arithmetic", | ||
| Algebra = "Algebra", | ||
| Geometry = "Geometry", | ||
| Functions = "Functions", | ||
| Calculus = "Calculus", | ||
| Statistics = "Statistics", | ||
|
|
||
| // Maths -> Number topics | ||
| Arithmetic = "Arithmetic", | ||
| RationalNumbers = "Rational Numbers", | ||
| FactorsPowers = "Factors & Powers", | ||
| ComplexNumbers = "Complex Numbers", | ||
|
|
||
| // Maths -> Algebra topics | ||
| Manipulation = `Manip${softHyphen}ulation`, | ||
| Quadratics = `Quadra${softHyphen}tics`, | ||
| SimultaneousEquations = `Simul${softHyphen}taneous Equations`, | ||
| Series = "Series", | ||
| Matrices = "Matrices", | ||
|
|
||
| // Maths -> Geometry topics | ||
| Shapes = "Shapes", | ||
| Statics = "Statics", | ||
| Units = "Units", | ||
| Kinematics = "Kinematics" | ||
| Trigonometry = `Trigon${softHyphen}ometry`, | ||
| Vectors = "Vectors", | ||
| Planes = "Planes", | ||
| Coordinates = "Coordinates", | ||
|
|
||
| // Maths -> Functions topics | ||
| GeneralFunctions = "General Functions", | ||
| GraphSketching = "Graph Sketching", | ||
|
|
||
| // Maths -> Calculus topics | ||
| Differentiation = `Differen${softHyphen}tiation`, | ||
| Integration = `Inte${softHyphen}gration`, | ||
| DifferentialEquations = `Differ${softHyphen}ential Equations`, | ||
|
|
||
| // Maths -> Statistics topics | ||
| DataAnalysis = "Data Analysis", | ||
| Probablity = `Probabi${softHyphen}lity`, | ||
| RandomVariables = "Random Variables", | ||
| HypothesisTests = `Hypo${softHyphen}thesis Tests` | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand the purpose of this enum. Is it just a subset of topic names that happen to be used in the tests?
Is there any reason we can't just use either this list or the tags service to get a list of topics when needed in the question finder tests? Hardcoding a subset of topic names here means one more place to keep updated if/when topics are added/removed/renamed, and we don't get the benefit of the tags structure to automatically find parents/children etc, which means yet more hardcoding when we want to use those relationships. It just feels quite fragile, susceptible to mistakes (see Probability typo), and introduces a lot of overhead for something that's only used in tests anyway.
I realise that not all of this was added in this PR, so maybe we do genuinely need this somewhere, in which case ignore this comment.
| [F.Number, F.Algebra, F.Geometry, F.Functions, F.Calculus, F.Statistics, F.Mechanics] | ||
| ); | ||
|
|
||
| const numberTopics = [F.Arithmetic, F.RationalNumbers, F.FactorsPowers, F.ComplexNumbers]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment on filters.ts; can this not just be tags.getChildren(TAG_ID.number).map(t => t.title); (and similarly for the other usages)?
If this does need to use the Filter enum, I'd maybe advocate for not renaming the import to make it clearer where this comes from (I was confused about what F was when first reading this). I appreciate that would make some of these lines very long, though.
|
@axlewin, I've addressed all your concerns, except the concern about the
It somewhat contradicts the argument I make above that in the tests for Can you please review this again? If you still feel the |
|
Looks good to me 👍 . I see your points about I'm still not sure that |
Despite there being possible follow-ups to this story that
I also just wanted to implement the changes requested by the content teams, which were to the GCSE maths question finder only.
I opted to use a list of allowed tags for filtering the possible filter choices, hoping this will be most compatible with a future implementation of those features (where these tags might come from the backend). This is a bit of a gamble: it's possible we'll never do those, and then there probably would have been easier implementations.
I started by fixing some style issues, and then added
updateTopicChoicesfunction. Although these are a little more implementation-specific than I usually like, in this case I found they helped me understand what this function did. I also noticed that the return value of this function was a little surprising on context-specific question finders (the list of fields was duplicated in the first position, which is reserved for subjects on the main QF), so I changed this to return subjects, after a discussion with @sjd210. This is was just for the sake of consistency, as the first element is not used on context-specific question finders.I then implemented the ability to hide disallowed topics in
updateTopicChoices, and hid the higher-level topics from the GCSE Maths question finder in the last commit.