From ca82e395f4d80208530028f2a86fdfbb36a18d70 Mon Sep 17 00:00:00 2001 From: peptiderepo Date: Sun, 26 Apr 2026 02:36:56 +0000 Subject: [PATCH] fix: model picker price sort broken for image models (v0.13.9) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit applySort() always read input_price_per_m for price sorting, but image models carry cost_per_image instead — input_price_per_m is undefined on them, so every image model got an effective price of 0 and the sort was a no-op. Fix: detect image models via cost_per_image !== undefined and use that field when present; fall back to input_price_per_m for text models. Files changed: - assets/js/model-picker.js — applySort price branch - prautoblogger.php — version bump 0.13.8 → 0.13.9 - CHANGELOG.md — release notes --- CHANGELOG.md | 8 ++++++++ assets/js/model-picker.js | 5 +++-- prautoblogger.php | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57a0f54..607fea4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to PRAutoBlogger will be documented in this file. Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project uses [Semantic Versioning](https://semver.org/). +## [0.13.9] - 2026-04-26 + +### Fixed +- Model picker sort by price now works correctly for image models — previously + \`applySort\` always read \`input_price_per_m\` (undefined on image models), + so every image had an effective price of 0 and price sort was a no-op. + Fix: detect image models via \`cost_per_image\` and use that field instead. + ## [0.13.8] - 2026-04-26 ### Added diff --git a/assets/js/model-picker.js b/assets/js/model-picker.js index abf38dd..33ef463 100644 --- a/assets/js/model-picker.js +++ b/assets/js/model-picker.js @@ -101,8 +101,9 @@ var valA, valB; if ( col === 'price' ) { - valA = a.input_price_per_m || 0; - valB = b.input_price_per_m || 0; + // Image models use cost_per_image; text models use input_price_per_m. + valA = ( a.cost_per_image !== undefined ) ? a.cost_per_image : ( a.input_price_per_m || 0 ); + valB = ( b.cost_per_image !== undefined ) ? b.cost_per_image : ( b.input_price_per_m || 0 ); } else if ( col === 'context' ) { valA = a.context_length || 0; valB = b.context_length || 0; diff --git a/prautoblogger.php b/prautoblogger.php index 0647c1e..ce1c90f 100644 --- a/prautoblogger.php +++ b/prautoblogger.php @@ -9,7 +9,7 @@ * Plugin Name: PRAutoBlogger * Plugin URI: https://peptiderepo.com/prautoblogger * Description: Monitors social media for trending topics, generates SEO-friendly blog posts using AI, and publishes them on a daily schedule with full cost tracking and self-improvement metrics. - * Version: 0.13.8 + * Version: 0.13.9 * Requires at least: 6.0 * Requires PHP: 7.4 * Author: PeptideRepo @@ -35,7 +35,7 @@ if ( ! defined( 'ABSPATH' ) ) { | Defined here so every file in the plugin can reference paths, versions, | and limits without magic strings. */ -define( 'PRAUTOBLOGGER_VERSION', '0.13.8' ); +define( 'PRAUTOBLOGGER_VERSION', '0.13.9' ); define( 'PRAUTOBLOGGER_DB_VERSION', '1.1.0' ); define( 'PRAUTOBLOGGER_PLUGIN_FILE', __FILE__ ); define( 'PRAUTOBLOGGER_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );