add "Deleted" and "Downloading" to "Download Status" filter

pull/157/head
Arno Hautala 4 years ago
parent 8a2f7af9e8
commit 2f81f9308e

@ -352,7 +352,7 @@ var app = new Vue({
this.submitFilters()
},
selectedDownloadStatus(current,old){
this.filter.isDownloaded=current.Value;
this.filter.downloadStatus=current.Value;
this.submitFilters()
},
selectedPlayedStatus(current,old){
@ -400,7 +400,7 @@ var app = new Vue({
}
for(var i=0;i<this.downloadStatusOptions.length;i++){
if(this.downloadStatusOptions[i].Value===this.filter.isDownloaded.toString()){
if(this.downloadStatusOptions[i].Value===this.filter.downloadStatus.toString()){
this.selectedDownloadStatus=this.downloadStatusOptions[i]
}
}
@ -580,8 +580,18 @@ var app = new Vue({
tags:{{.tags}},
sortOptions:{{.sortOptions}},
pagingOptions:[10,20,50,100],
downloadStatusOptions:[{"Label":"All","Value":"nil"},{"Label":"Downloaded Only","Value":"true"},{"Label":"Not Downloaded","Value":"false"}],
playedStatusOptions:[{"Label":"All","Value":"nil"},{"Label":"Played Only","Value":"true"},{"Label":"Unplayed only","Value":"false"}],
downloadStatusOptions:[
{"Label":"All","Value":"nil"},
{"Label":"Downloaded","Value":"2"},
{"Label":"Not Downloaded","Value":"0"},
{"Label":"Deleted","Value":"3"},
{"Label":"Downloading","Value":"1"}
],
playedStatusOptions:[
{"Label":"All","Value":"nil"},
{"Label":"Played Only","Value":"true"},
{"Label":"Unplayed only","Value":"false"}
],
}})
</script>

@ -58,15 +58,8 @@ func GetPaginatedPodcastItemsNew(queryModel model.EpisodesFilter) (*[]PodcastIte
var podcasts []PodcastItem
var total int64
query := DB.Debug().Preload("Podcast")
if queryModel.IsDownloaded != nil {
isDownloaded, err := strconv.ParseBool(*queryModel.IsDownloaded)
if err == nil {
if isDownloaded {
query = query.Where("download_status=?", Downloaded)
} else {
query = query.Where("download_status!=?", Downloaded)
}
}
if queryModel.DownloadStatus != nil && *queryModel.DownloadStatus != "nil" {
query = query.Where("download_status=?", queryModel.DownloadStatus)
}
if queryModel.IsPlayed != nil {
isPlayed, err := strconv.ParseBool(*queryModel.IsPlayed)
@ -252,16 +245,16 @@ func GetEpisodeNumber(podcastItemId, podcastId string) (int, error) {
var id string
var sequence int
row := DB.Raw(`;With cte as(
SELECT
id,
RANK() OVER (ORDER BY pub_date) as sequence
FROM
SELECT
id,
RANK() OVER (ORDER BY pub_date) as sequence
FROM
podcast_items
WHERE
podcast_id=?
)
select *
from cte
select *
from cte
where id = ?
`, podcastId, podcastItemId).Row()
error := row.Scan(&id, &sequence)

@ -22,12 +22,12 @@ const (
type EpisodesFilter struct {
Pagination
IsDownloaded *string `uri:"isDownloaded" query:"isDownloaded" json:"isDownloaded" form:"isDownloaded"`
IsPlayed *string `uri:"isPlayed" query:"isPlayed" json:"isPlayed" form:"isPlayed"`
Sorting EpisodeSort `uri:"sorting" query:"sorting" json:"sorting" form:"sorting"`
Q string `uri:"q" query:"q" json:"q" form:"q"`
TagIds []string `uri:"tagIds" query:"tagIds[]" json:"tagIds" form:"tagIds[]"`
PodcastIds []string `uri:"podcastIds" query:"podcastIds[]" json:"podcastIds" form:"podcastIds[]"`
DownloadStatus *string `uri:"downloadStatus" query:"downloadStatus" json:"downloadStatus" form:"downloadStatus"`
IsPlayed *string `uri:"isPlayed" query:"isPlayed" json:"isPlayed" form:"isPlayed"`
Sorting EpisodeSort `uri:"sorting" query:"sorting" json:"sorting" form:"sorting"`
Q string `uri:"q" query:"q" json:"q" form:"q"`
TagIds []string `uri:"tagIds" query:"tagIds[]" json:"tagIds" form:"tagIds[]"`
PodcastIds []string `uri:"podcastIds" query:"podcastIds[]" json:"podcastIds" form:"podcastIds[]"`
}
func (filter *EpisodesFilter) VerifyPaginationValues() {

Loading…
Cancel
Save