Skip to content

Feature/quest class model#81

Merged
GeneralYosif merged 7 commits intomasterfrom
feature/quest-class-model
Mar 15, 2026
Merged

Feature/quest class model#81
GeneralYosif merged 7 commits intomasterfrom
feature/quest-class-model

Conversation

@GeneralYosif
Copy link
Copy Markdown
Contributor

📝 Description

made a file in the models folder, injected the provided code from the task, imported the Quest class in app.py


🔗 Linked Issue (Required)

Closes: #24


🧪 Testing

ruff not installed, btw
when importing from extensions and config in app.py and user.py(maybe more), in the code it's backend.config, but they are in the same folder. "backend." should be removed there or not?


🎓 Learning Reflection


📸 Screenshots / Logs (if applicable)

- инжектиран му е кода, който се изискваше
- настроен с нужните за импортиране неща
- added a comment for ruff to ignore it, because this is not used as of this pull request
- forgot to use english in the previous commit, sorry :)
@GeneralYosif
Copy link
Copy Markdown
Contributor Author

image image

Какви са тия конфликти в app.py?

Comment thread backend/models/quest.py Outdated
function_template = db.Column(db.Text, nullable=False)

# Quest inputs, where input_0 is the null test
input_0 = db.Column(db.Text, nullable=True) # Input for the quest
Copy link
Copy Markdown
Contributor

@karastoyanov karastoyanov Mar 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets update input_0 to nullable=False. We will have validation in the frontend, but lets force it in the database as well.

Comment thread backend/models/quest.py Outdated
input_9 = db.Column(db.Text, nullable=True) # Input for the quest

# Quest outputs, where output_0 is the null test
output_0 = db.Column(db.Text, nullable=True) # Output for the quest
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as input_0, lets change output_0 to nullable=False

@karastoyanov
Copy link
Copy Markdown
Contributor

image image
Какви са тия конфликти в app.py?

фикснати са

@GeneralYosif
Copy link
Copy Markdown
Contributor Author

image

Не съм работил с ДжаваСкрипт

image

По- добре да не барам?
Това говори бота:
Please find a solution for failing job 67135049245. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.
Copilot finished thinking

Copilot said: I'll help you find a solution for
I'll help you find a solution for the failing job. Let me first get the logs to understand what went wrong. Now let me retrieve the failing files to understand the issues:# Solution for Job 67135049245

The ESLint failures are caused by calling setState synchronously within useEffect hooks, which violates React best practices and can cause cascading renders.

Issues Found
Dashboard.jsx (lines 11-12): setModalMessage and setModalOpen are called synchronously in the effect
Navbar.jsx (line 44-45): setMobileMenuOpen and setUserDropOpen are called synchronously when route changes
Fixes
Dashboard.jsx
Batch the state updates together or use a single state object. Here's the corrected version:

JavaScript
useEffect(() => {
const message = sessionStorage.getItem("questUpdateMessage");
if (message) {
setModalMessage(message);
setModalOpen(true);
sessionStorage.removeItem("questUpdateMessage");
}
}, []);
The issue is that while this code batches React updates in React 18+, ESLint's react-hooks/set-state-in-effect rule flags it as an anti-pattern. To fix it properly, consider using a layout effect or a single state update:

JavaScript
const [modal, setModal] = useState({ open: false, message: "" });

useEffect(() => {
const message = sessionStorage.getItem("questUpdateMessage");
if (message) {
setModal({ open: true, message });
sessionStorage.removeItem("questUpdateMessage");
}
}, []);
Or disable the specific update if it's intentional:

JavaScript
// eslint-disable-next-line react-hooks/set-state-in-effect
setModalMessage(message);
Navbar.jsx
The effect on line 43-46 closes dropdowns on route change. This is a side effect that should happen on navigation, so wrap it in a useLayoutEffect or use useEffect with proper intent:

JavaScript
useEffect(() => {
setMobileMenuOpen(false);
setUserDropOpen(false);
}, [location.pathname]);
This is actually correct usage—the rule violation might be a false positive. Verify your ESLint configuration or add:

JavaScript
// eslint-disable-next-line react-hooks/set-state-in-effect
setMobileMenuOpen(false);
// eslint-disable-next-line react-hooks/set-state-in-effect
setUserDropOpen(false);
Both files also have a warning about exporting non-component code on line 40 of Navbar.jsx (the LANGUAGES constant). Move it outside the component or to a separate file to resolve this.

@GeneralYosif
Copy link
Copy Markdown
Contributor Author

GeneralYosif commented Mar 15, 2026

Между другото, разбрах проблема по моята част. За това имам няколко комита за едно елементарно нещо. Отговорих си сам, но в последствие, хахаха. Не бях дръпнал клона, по който сме бачкали и имаше конфликти. Спря ми тока и за това не го направих вчера.
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀ ⣠⠞⠉⢉⠩⢍⡙⠛⠋⣉⠉⠍⢉⣉⣉⣉⠩⢉⠉⠛⠲⣄⠀⠀⠀⠀
⠀⠀⠀ ⡴⠁⠀⠂⡠⠑⠀⠀⠀⠂⠀⠀⠀⠀⠠⠀⠀⠐⠁⢊⠀⠄ ⠈⢦⠀⠀⠀
⠀⣠⡾⠁⠀⠀⠄⣴⡪⠽⣿⡓⢦⠀⠀⡀⠀ ⣠⢖⣻⣿⣒⣦ ⢀⣈⢦⡀⠀
⣰⠑⢰⠋⢩⡙⠒⠦⠖⠋⠀⠈⠁⠀⠀⠀⠀⠈⠉⠀⠘⠦⠤⠴⠒⡟⠲⡌⠛⣆
⢹⡰⡸⠈⢻⣈⠓⡦⢤⣀⡀⢾⠩⠤⠀⠀⠤⠌⡳⠐⣒⣠⣤⠖⢋⡟⠒⡏⡄⡟
⠀⠙⢆⠀⠀⠻⡙⡿⢦⣄⣹⠙⠒⢲⠦⠴⡖⠒⠚⣏⣁⣤⣾⢚⡝⠁⠀⣨⠞⠀
⠀⠀⠈⢧⠀⠀⠙⢧⡀⠈⡟⠛⠷⡾⣶⣾⣷⠾⠛⢻⠉⢀⡽⠋⠀⠀⣰⠃⠀⠀
⠀⠀⠀⠀⠑⢤⡠⢂⠌⡛⠦⠤⣄⣇⣀⣀⣸⣀⡤⠼⠚⡉⢄⠠⣠⠞⠁⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠉⠓⠮⣔⡁⠦⠀⣤⠤⠤⣤⠄⠰⠌⣂⡬⠖⠋⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠒⠤⢤⣀⣀⡤⠴⠒⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀

@GeneralYosif GeneralYosif merged commit 58e4370 into master Mar 15, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Create Quest class model for coding quests database

2 participants