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

Main #196

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Main #196

wants to merge 4 commits into from

Conversation

snehas-05
Copy link

Issue number #185
This pull request introduces a Profile Badges and Achievements system to enhance student engagement and motivation on the Research-Nexas platform. The feature allows students to earn badges for significant accomplishments, such as submitting research papers, achieving high evaluation scores, and actively participating in peer reviews and collaborations.

Key Features
Badge Creation: Admins can create badges with specific criteria.
Awarding Badges: Badges can be awarded to students based on their achievements.
Viewing Badges: Students can view all badges available and those they have earned.
Database Integration: New tables for badges and student-badge relationships have been added to the MySQL database.

Instructions for Implementation-

  1. Database Setup: Execute the provided SQL statements to create the badges and student_badges tables in your MySQL database.
    Ensure that your database connection in config/db.js is properly configured to communicate with your MySQL server.

  2. Connect Routes: Import the badges route in your main application file (e.g., app.js)
    const badgesRouter =require('./routes/badges');
    app.use('/api/badges', badgesRouter);

  3. Testing the API: Use Postman or a similar tool to test the following endpoints:
    POST /api/badges/create: Create a new badge.
    GET /api/badges: Retrieve all badges.
    POST /api/badges/award: Award a badge to a student.
    GET /api/badges/:studentId: Retrieve badges for a specific student.

I know you’re already familiar with these instructions, but I’m including them here to ensure a smooth running of the feature. Please review the code changes thoroughly and let me know if you have any questions or need further modifications. Thankyou.

✅ Checklist

Before submitting the PR, please make sure you have completed the following:

  • [ ✓] I have followed all the guidlines mentioned in CONTRIBUTING.md.
  • [✓ ] My code follows the style guidelines of this project.
  • [✓ ] I have performed a self-review of my own code.
  • [✓ ] I have commented my code, particularly in hard-to-understand areas.
  • [✓ ] I have made corresponding changes to the documentation (if applicable).
  • [✓ ] I have tested it locally and it works fine.
  • [✓ ] Any dependent changes have been merged and published in downstream modules.

🏷️ Types of Changes

What type of changes does your code introduce? (Check all that apply)

  • Bug fix (non-breaking change which fixes an issue) 🐛
  • [✓ ] New feature (non-breaking change which adds functionality) ✨
  • UI enhancement (non-breaking change which enhances UI) 🎨
  • Documentation update 📚

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

🎉 Thank you @snehas-05 for your contribution! Your pull request has been submitted successfully. A maintainer will review it as soon as possible. We appreciate your support in making this project better

@snehas-05
Copy link
Author

@Harshdev098 kindly have a look on this pr once.

Copy link
Owner

@Harshdev098 Harshdev098 left a comment

Choose a reason for hiding this comment

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

  • Don't make another server(app.js) include it in the server.js file and make new endpoints for badges including making of badges and giving acheivements badges to user
  • Remove the config folder its already there implemented
  • Remove the package.json file because there will be only one server for now
  • You have not integrated the backend with frontend so remove the files in the views folder(layout,profile). We will improve it to integrate it in better ways
  • Also please sync fork and update your clone with updated branch code

@snehas-05
Copy link
Author

Hey @Harshdev098 I have made all the necessary changes you asked me to do, committed them and synced also. Now do I need to create a new pr? Or is this pr sufficient?

@Harshdev098
Copy link
Owner

It's sufficient

Copy link
Owner

@Harshdev098 Harshdev098 left a comment

Choose a reason for hiding this comment

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

  • Remove the controller folder you have implemented the same thing in the badges.js

Copy link
Owner

@Harshdev098 Harshdev098 left a comment

Choose a reason for hiding this comment

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

  • Remove the styles.css
  • Also you can remove the models folder because we are have config folder to connect with the database you can export that function to use here

@@ -14,6 +14,29 @@ const { allot, DisplayPapers } = require("../stakeholder/allotment");
const { Dis_fac_papers, fac_signup, fac_login, dis_mail, giverating } = require("../stakeholder/faculty");
const app = express();

const mysql = require('mysql2');
Copy link
Owner

Choose a reason for hiding this comment

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

instead of importing mysql module you can import the function in the config folder of main branch

database: process.env.DB_NAME
});

db.connect((err) => {
Copy link
Owner

Choose a reason for hiding this comment

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

the function in the config folder will connect to the database remove these lines of code to connect the db

@Harshdev098
Copy link
Owner

Also remove the modules folder as I said the db connection is build using the config folder @snehas-05

Copy link
Owner

@Harshdev098 Harshdev098 left a comment

Choose a reason for hiding this comment

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

Also delete the sql file instead of writing sql queries in this file include it in the readme file under running the application
Just add the badges table creation and student badges creation sql queries

-- Select the database to use
USE research_nexas;

-- Create the 'student' table
Copy link
Owner

Choose a reason for hiding this comment

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

Delete this table its already created

@Harshdev098
Copy link
Owner

@snehas-05 Please! Before opening a PR make sure that your fork is synced and clone is up to date with the main branch of the repo

@Harshdev098
Copy link
Owner

Harshdev098 commented Nov 10, 2024

@snehas-05 The changes are not satisfactory, many changes are required to accomplish this feature.
Many of the requested changes not being done

@snehas-05
Copy link
Author

From my side all the changes you requested I have made.

@Harshdev098
Copy link
Owner

I have just mentioned this-

image

but you have written all the queries
Also you have not changed this ,

image

@snehas-05
Copy link
Author

snehas-05 commented Nov 10, 2024

@Harshdev098 I'm so sorry for all the mess I have removed the unnecessary queries syntax. And for this db code I think this file is not mine.(The code in this is not written by me)

@snehas-05
Copy link
Author

snehas-05 commented Nov 10, 2024

@Harshdev098 ?.

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.

2 participants