Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#186 Memes evaluations amount restriction #201

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/src/memes/memes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const MEME_IS_SKIPPED = 'Я запомнил, что это не\xa0мем';
const ERROR_OCCURED = 'Произошла ошибка, попробуйте позже';

const REQUIRED_SKIP_REQUESTS = 2;
const REQUIRED_EVALUATIONS = 3;
const MEMES_DIR = 'memes';

function getPhotoSize(message: VkMessage): VkPhotoSize | null {
Expand Down Expand Up @@ -224,6 +225,7 @@ export async function getMemesStatistics(): Promise<MemesStatistics> {
FROM friends_vk_bot.memes
JOIN friends_vk_bot.memes_evaluations me ON memes.conversation_message_id = me.conversation_message_id
GROUP BY memes.conversation_message_id
HAVING count(*) >= ${REQUIRED_EVALUATIONS}
ORDER BY rating DESC
LIMIT 5
`);
Expand Down
Loading