Spaces:
Running
Running
Commit ·
dff77f6
1
Parent(s): ac128ef
Skip sentiment and news_count columns for challenge_table
Browse files- src/lib/dataService.js +7 -2
src/lib/dataService.js
CHANGED
|
@@ -192,6 +192,11 @@ class DataService {
|
|
| 192 |
/**
|
| 193 |
* 从 Supabase 拉取所有数据
|
| 194 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
async _fetchAllFromRemote() {
|
| 196 |
// First, get the max date from DB to know what we're aiming for
|
| 197 |
let dbMaxDate = null
|
|
@@ -235,7 +240,7 @@ class DataService {
|
|
| 235 |
|
| 236 |
const { data, error } = await supabase
|
| 237 |
.from(this.sourceTable)
|
| 238 |
-
.select(
|
| 239 |
.order('date', { ascending: true })
|
| 240 |
.range(from, to)
|
| 241 |
|
|
@@ -297,7 +302,7 @@ class DataService {
|
|
| 297 |
|
| 298 |
const { data: missingData, error: missingError } = await supabase
|
| 299 |
.from(this.sourceTable)
|
| 300 |
-
.select(
|
| 301 |
.gte('date', nextDayStr)
|
| 302 |
.lte('date', dbMaxDateStr)
|
| 303 |
.order('date', { ascending: true })
|
|
|
|
| 192 |
/**
|
| 193 |
* 从 Supabase 拉取所有数据
|
| 194 |
*/
|
| 195 |
+
_selectColumns() {
|
| 196 |
+
const base = 'id, agent_name, asset, model, date, price, recommended_action, created_at, updated_at'
|
| 197 |
+
return this.sourceTable === 'challenge_table' ? base : `${base}, news_count, sentiment`
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
async _fetchAllFromRemote() {
|
| 201 |
// First, get the max date from DB to know what we're aiming for
|
| 202 |
let dbMaxDate = null
|
|
|
|
| 240 |
|
| 241 |
const { data, error } = await supabase
|
| 242 |
.from(this.sourceTable)
|
| 243 |
+
.select(this._selectColumns())
|
| 244 |
.order('date', { ascending: true })
|
| 245 |
.range(from, to)
|
| 246 |
|
|
|
|
| 302 |
|
| 303 |
const { data: missingData, error: missingError } = await supabase
|
| 304 |
.from(this.sourceTable)
|
| 305 |
+
.select(this._selectColumns())
|
| 306 |
.gte('date', nextDayStr)
|
| 307 |
.lte('date', dbMaxDateStr)
|
| 308 |
.order('date', { ascending: true })
|