Skip to content

Commit

Permalink
Debug Product Sort By Newest
Browse files Browse the repository at this point in the history
  • Loading branch information
Hossara committed Apr 5, 2022
1 parent 7707cb9 commit c94cd02
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/client/src/views/dashboard/AddProducts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ const cities = require('@/assets/json/cities.json')
productFormData.append("amount", (inputs[4] as HTMLInputElement).value)
productFormData.append("ppk", (inputs[5] as HTMLInputElement).value)
productFormData.append("description", (textarea as HTMLTextAreaElement).value)
productFormData.append("date", new Date().toISOString())
axios.post(
"/api/rest/product/add",
Expand Down
18 changes: 5 additions & 13 deletions src/client/src/views/surface/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,6 @@ import {watch} from "vue"
this.searchClient.subscribe('/user/search/get', function (response)
{
const resp = JSON.parse(response.body)
console.log(resp[1])
if (resp[1].length === 0)
{
t.searchResult = null
Expand Down Expand Up @@ -401,18 +400,11 @@ import {watch} from "vue"
{
this.sortedSearchResult = this.searchResult.sort((a, b) =>
{
if(this.sort_by === 'near')
{
return +new Date(b["dat"]) - +new Date(a["dat"])
}
else if(this.sort_by === 'cheap')
{
return a["ppk"] - b["ppk"]
}
else if(this.sort_by === 'mex')
{
return b["ppk"] - a["ppk"]
}
if(this.sort_by === 'near') return +new Date(b["date"]) - +new Date(a["date"])
else if(this.sort_by === 'cheap') return a["ppk"] - b["ppk"]
else if(this.sort_by === 'mex') return b["ppk"] - a["ppk"]
})
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ class ProductRestController
it.bs,
it.description,
seller,
company
company,
it.date
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ class SearchController(
it.bs,
it.description,
seller,
company
company,
it.date
)
}

Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/org/yastech/weeki/model/ProductCard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ data class ProductCard
var description: String,
var seller: String?,
var company: String?,
var date: String?
)

0 comments on commit c94cd02

Please sign in to comment.