🪛 Refactoring to use the updated rendition path
This commit is contained in:
@@ -22,23 +22,17 @@ class Card extends React.Component<IProps, IState> {
|
||||
public drawCoverCard = (
|
||||
metadata: IExtractedComicBookCoverFile,
|
||||
): JSX.Element => {
|
||||
const filePath = encodeURI(
|
||||
"http://localhost:3000" +
|
||||
removeLeadingPeriod(metadata.path) +
|
||||
"/" +
|
||||
metadata.name,
|
||||
const encodedFilePath = encodeURI(
|
||||
"http://localhost:3000" + removeLeadingPeriod(metadata.path),
|
||||
);
|
||||
|
||||
const filePath = escapePoundSymbol(encodedFilePath);
|
||||
return (
|
||||
<div>
|
||||
<div className="card generic-card">
|
||||
<div>
|
||||
<div className="card-image">
|
||||
<figure className="image">
|
||||
<img
|
||||
src={escapePoundSymbol(filePath)}
|
||||
alt="Placeholder image"
|
||||
/>
|
||||
<img src={filePath} alt="Placeholder image" />
|
||||
</figure>
|
||||
</div>
|
||||
<div className="card-content">
|
||||
|
||||
@@ -55,7 +55,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
getRecentlyImportedComicBooks({
|
||||
paginationOptions: {
|
||||
page: 0,
|
||||
limit: 18,
|
||||
limit: 31,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -166,8 +166,8 @@ export const refineQuery = (inputString) => {
|
||||
return {
|
||||
searchParams: {
|
||||
searchTerms: {
|
||||
name: queryObj.sentence_tokens.detailed[0].text,
|
||||
number: queryObj.comicbook_identifier_tokens.issueNumbers,
|
||||
name: queryObj.comicbook_identifier_tokens.inputString,
|
||||
number: queryObj.comicbook_identifier_tokens.parsedIssueNumber,
|
||||
},
|
||||
},
|
||||
meta: {
|
||||
|
||||
@@ -6,5 +6,5 @@ export const removeLeadingPeriod = (input: string): string => {
|
||||
};
|
||||
|
||||
export const escapePoundSymbol = (input: string): string => {
|
||||
return input.replace(/\#/gi, "%23");
|
||||
return input.replace(/\#/gm, "%23");
|
||||
};
|
||||
|
||||
@@ -9,15 +9,33 @@ export const matchScorer = (searchMatches, searchQuery) => {
|
||||
// 5. Check if issue year matches strongly (score: +)
|
||||
const score = 0;
|
||||
each(searchMatches, (match, idx) => {
|
||||
if (!isNull(searchQuery.issue.meta.normalized) && !isNull(match.name)) {
|
||||
console.log("SEARCH QUERY IN SMS:", searchQuery);
|
||||
console.log("MATCH NAME:", match);
|
||||
match.score = 0;
|
||||
if (
|
||||
!isNull(searchQuery.issue.searchParams.searchTerms.name) &&
|
||||
!isNull(match.name)
|
||||
) {
|
||||
const issueNameScore = stringSimilarity.compareTwoStrings(
|
||||
searchQuery.issue.meta.normalized,
|
||||
searchQuery.issue.searchParams.searchTerms.name,
|
||||
match.name,
|
||||
);
|
||||
match.score = issueNameScore;
|
||||
console.log("name score" + idx + ":", issueNameScore);
|
||||
} else {
|
||||
console.log("match not possible");
|
||||
}
|
||||
|
||||
// issue number matches
|
||||
if (
|
||||
!isNull(searchQuery.issue.searchParams.searchTerms.number) &&
|
||||
!isNull(match.issue_number)
|
||||
) {
|
||||
if (
|
||||
parseInt(searchQuery.issue.searchParams.searchTerms.number, 10) ===
|
||||
parseInt(match.issue_number, 10)
|
||||
) {
|
||||
match.score += 2;
|
||||
console.log(match.score);
|
||||
}
|
||||
}
|
||||
});
|
||||
return searchMatches;
|
||||
|
||||
Reference in New Issue
Block a user