Skip to content

Commit

Permalink
fix(imgur): reverses the logic of the sortTags method when sorting fo…
Browse files Browse the repository at this point in the history
…r 'relevance' (queue)

this update still needs to be tested in production
  • Loading branch information
KenEucker committed Mar 6, 2022
1 parent 4fb2683 commit 62e819d
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 10 deletions.
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG] "
labels: Bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Call method '...'
2. Await promise '....'
3. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Environment (please complete the following information):**
- Library version [e.g. 1.0.0]:
- OS [e.g. macOS]:
- NodeJS version [e.g.14.16.0]:

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: Feature Request
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
8 changes: 4 additions & 4 deletions src/common/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,13 +524,13 @@ export const sortTags = (tags: Tag[], sort = 'new', limit = 0): Tag[] => {
const bHasMysteryImage = b.mysteryImageUrl?.length
const aHasBothImages = aHasFoundImage && aHasMysteryImage
const bHasBothImages = bHasFoundImage && bHasMysteryImage
const bIsBeforeA = 1
const aIsBeforeB = -1
const bIsBeforeA = -1
const aIsBeforeB = 1

if (!aHasBothImages && !bHasBothImages) {
/// compare individual images
if (aHasFoundImage && bHasFoundImage) {
return b.foundTime - a.foundTime
return a.foundTime - b.foundTime
} else if (aHasFoundImage) {
return aIsBeforeB
} else if (bHasFoundImage) {
Expand All @@ -539,7 +539,7 @@ export const sortTags = (tags: Tag[], sort = 'new', limit = 0): Tag[] => {
/// should be unreachable code
} else if (aHasBothImages && bHasBothImages) {
/// compare all images upload timestamps
const firstToComplete = b.mysteryTime - a.mysteryTime
const firstToComplete = a.mysteryTime - b.mysteryTime
return firstToComplete
} else if (aHasBothImages && !bHasBothImages) {
return bIsBeforeA
Expand Down
4 changes: 2 additions & 2 deletions src/common/schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { geopoint, boundary } from './types'
import { geopoint } from './types'

/// **************************** Schema Data Types ********************************** ///
export type UserMetadata = {
Expand Down Expand Up @@ -80,7 +80,7 @@ export interface Game {
name: string
ambassadors: string[]
settings: settingsArray
boundary: boundary
boundary: geopoint
mainhash?: string
archivehash?: string
queuehash?: string
Expand Down
4 changes: 0 additions & 4 deletions src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@ export type geopoint = {
alt: number
}

export type boundary = {
geo: geopoint
}

/// **************************** BikeTag Configurations ***************************** ///
export type BikeTagConfiguration = {
biketag: BikeTagCredentials
Expand Down

0 comments on commit 62e819d

Please sign in to comment.