Where's wrong???? :(

I want to use a dataset to calculation via dropdown option but sometimes it run, sometimes not! Also dropdown box not working on mobile. Could you help me, what’wrong? I think “price” is not defining as value. Codes below:

import wixData from ‘wix-data’ ;
$w . onReady ( async function () {
$w ( “#ulke” ). options = await populateDropdown ( “Cost” , “cost” );
});
export function ulke_change ( event ) {
console . log ( $w ( “#ulke” ). value );
}
export function populateDropdown ( collectionName , valueField ) {
let allItems = ;
return wixData . query ( collectionName )
. ascending ( “title” )
. find ()
. then (( results ) => {
if ( results . totalCount > 0 ) {
let items = results . items ;
items . forEach (( item ) => {
let oneItem = {
label : item . title ,
value : item [ valueField ]. toString ()

            } 
        allItems . push ( oneItem ); 
    }) 
    **return**  allItems ; 
} 
**return null** ; 

})

}
export function hesapla_click ( event ) {
let cTime1 = $w ( ‘#ilktarih’ ). value , cTime2 = $w ( ‘#sontarih’ ). value ;
let dDate = new Date ();
let YearValue = dDate . getFullYear ();
let MonthValue = dDate . getMonth ();
let DayValue = dDate . getDate ();
let DateTime1 = new Date ( YearValue , MonthValue , DayValue );
let YearValue1 = Number ( cTime1 );
let MonthValue1 = Number ( cTime1 );
let DayValue1 = Number ( cTime1 );
let DateTime2 = new Date ( YearValue , MonthValue , DayValue );
let YearValue2 = Number ( cTime2 );
let MonthValue2 = Number ( cTime2 );
let DayValue2 = Number ( cTime2 );
var Year = YearValue2 - YearValue1 ;
var Month = MonthValue2 - MonthValue1 ;
var Day = DayValue2 - DayValue1 ;

var price = $w ( “#ulke” ). value ;
let Tottime = (( Year * 365 ) + ( Month * 30 ) + Day )/ 34214400000 ;
var yetiskin = parseFloat ( $w ( ‘#yetiskin’ ). value )
var cocuk = parseFloat ( $w ( ‘#cocuk’ ). value )
var total = ( yetiskin + ( cocuk * 0.6 )) * Tottime * price
$w ( ‘#total’ ). value = “€” + total . toString ()
}

You can actually skip the forEach function. Instead of getting all items from a collection and then filtering for the item that has the value you want you can instead pass the value you want into the query it’s self. Here is the API docs but I will also post some sample code below: Introduction - Velo API Reference - Wix.com

import wixData from "wix-data"

$w.onReady(() => {
    wixData.query(collectionName)
    .gt(collectionName,valueField)
    .ascending("title")
    .find()
    .then(data => {
    console.log(data)
        $w("#ulke").options = data  
    }
})