change community sentiment

This commit is contained in:
MuslemRahimi 2024-09-23 18:20:53 +02:00
parent e2d8934fe7
commit 2f05c5ee67
2 changed files with 3 additions and 3 deletions

View File

@ -90,7 +90,7 @@ $: {
What do you think of {$stockTicker} today?
</label>
<span class="text-white text-sm sm:text-[1rem] mt-1">
The community is {upvote > downvote ? 'bullish' : upvote < downvote ? 'bearish' : 'neutral'} about {$displayCompanyName} today.
The community is {upvote > downvote ? 'bullish' : upvote < downvote ? 'bearish' : 'neutral'} about {$displayCompanyName} this week, , with {totalVote} total votes.
</span>
</div>

View File

@ -46,14 +46,14 @@ const fetchWatchlist = async (pb, userId) => {
const fetchCommunitySentiment = async (pb, ticker, cookies) => {
const cookieVote = cookies.get(`community-sentiment-${ticker}`);
const today = new Date().toISOString().split("T")[0];
const tomorrow = new Date(new Date().setDate(new Date().getDate() + 1))
const tomorrow = new Date(new Date().setDate(new Date().getDate() + 7))
.toISOString()
.split("T")[0];
const output = await pb.collection("sentiment").getFullList({
filter: `ticker="${ticker}" && created >= "${today}" && created < "${tomorrow}"`,
});
console.log(output);
return {
alreadyVoted: cookieVote || null,
sentimentData: output?.at(0) || {},