File tree Expand file tree Collapse file tree 2 files changed +10
-11
lines changed
Expand file tree Collapse file tree 2 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -188,17 +188,13 @@ const apartsCountsByDaysChart = computed(() => {
188188});
189189
190190const listedVsUnlistedPriceByDays = computed (() => {
191- const arr = data .value ?.listedVsUnlistedPriceByDays ;
192-
193- if (! Array .isArray (arr )) return [];
194-
195- const reversed = arr .slice ().reverse ();
196-
197- return reversed .map (item => ({
198- x: dayjs (item .day ).format (' DD MMM' ),
199- listedPrice: item .listedPrice .toFixed (2 ),
200- unlistedPrice: item .unlistedPrice .toFixed (2 ),
201- }));
191+ return data .value .listedVsUnlistedPriceByDays ?.map (
192+ (item ) => ({
193+ x: dayjs (item .day ).format (' DD MMM' ),
194+ listedPrice: item .listedPrice .toFixed (2 ),
195+ unlistedPrice: item .unlistedPrice .toFixed (2 ),
196+ })
197+ );
202198});
203199
204200const listedVsUnlistedCountByDays = computed (() => {
Original file line number Diff line number Diff line change @@ -157,6 +157,7 @@ if (import.meta.url === `file://${process.argv[1]}`) {
157157 LIMIT ?;
158158 `
159159 ) . all ( days ) ;
160+ apartsByDays . reverse ( ) ;
160161
161162 const totalAparts = apartsByDays . reduce ( ( acc : number , { count } : { count :number } ) => acc + count , 0 ) ;
162163
@@ -174,6 +175,7 @@ if (import.meta.url === `file://${process.argv[1]}`) {
174175 LIMIT ?;
175176 `
176177 ) . all ( days ) ;
178+ listedVsUnlistedByDays . reverse ( ) ;
177179
178180 const apartsCountsByRooms = await db . prepare (
179181 `SELECT
@@ -214,6 +216,7 @@ if (import.meta.url === `file://${process.argv[1]}`) {
214216 LIMIT ?;
215217 `
216218 ) . all ( days ) ;
219+ listedVsUnlistedPriceByDays . reverse ( ) ;
217220
218221 const totalListedPrice = Math . round ( listedVsUnlistedByDays . reduce ( (
219222 acc : number , { listedPrice } : { listedPrice :number }
You can’t perform that action at this time.
0 commit comments