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

Part 2 #3

Open
wants to merge 2 commits into
base: base-sha/b0a93b24c77c7ac0e387ffbe94c72811e548f4e1
Choose a base branch
from

Conversation

sourcery-ai-experiments-bot
Copy link
Collaborator

@sourcery-ai-experiments-bot sourcery-ai-experiments-bot commented Jul 8, 2024

Summary by Sourcery

This pull request introduces a new 'Class Distribution Tool' page for managing class distributions, refactors the 'create_classes' function for better clarity, and updates multiple JSON files to standardize department references.

  • New Features:
    • Introduced a new 'Class Distribution Tool' page with a form for creating and managing class distributions, including fields for group title, year, stage, faculty, department, time, and semester.
  • Enhancements:
    • Refactored the 'create_classes' function to accept individual parameters instead of a document object, improving clarity and maintainability.
    • Updated various JSON files to replace 'Faculty Department' with 'Department' for consistency and accuracy in department references.
    • Modified the 'Graduation Year' field in the 'Student' doctype to be a selectable list of years instead of a date field.

@sourcery-ai-experiments-bot
Copy link
Collaborator Author

This is a benchmark review for experiment review_of_reviews_20240708.
Run ID: review_of_reviews_20240708/benchmark_2024-07-08T00-18-37_v1-20-0-4-gb56c705c9.

This pull request was cloned from https://github.com/osama1998H/kalima/pull/41. (Note: the URL is not a link to avoid triggering a notification on the original pull request.)

Experiment configuration
review_config:
  # User configuration for the review
  # - benchmark - use the user config from the benchmark reviews
  # - <value> - use the value directly
  user_review_config:
    enable_ai_review: true
    enable_rule_comments: false

    enable_complexity_comments: benchmark
    enable_security_comments: benchmark
    enable_tests_comments: benchmark
    enable_comment_suggestions: benchmark
    enable_functionality_review: benchmark

    enable_pull_request_summary: benchmark
    enable_review_guide: benchmark

    enable_approvals: true

  ai_review_config:
    # The model responses to use for the experiment
    # - benchmark - use the model responses from the benchmark reviews
    # - llm - call the language model to generate responses
    model_responses:
      comments_model: benchmark
      comment_area_model: benchmark
      comment_validation_model: benchmark
      comment_suggestion_model: benchmark
      complexity_model: benchmark
      docstrings_model: benchmark
      functionality_model: benchmark
      security_model: benchmark
      tests_model: benchmark
      pull_request_summary_model: benchmark
      review_guide_model: benchmark

# The pull request dataset to run the experiment on
pull_request_dataset:
- https://github.com/mraniki/iamlistening/pull/334
- https://github.com/mraniki/cefi/pull/475
- https://github.com/mraniki/MyLLM/pull/581
- https://github.com/mraniki/dxsp/pull/689
- https://github.com/jschalk/jaar/pull/239
- https://github.com/jschalk/jaar/pull/241
- https://github.com/jschalk/jaar/pull/242
- https://github.com/iptux-src/iptux/pull/620
- https://github.com/iptux-src/iptux/pull/622
- https://github.com/hacksider/Deep-Live-Cam/pull/46
- https://github.com/mnbf9rca/super_simple_tfl_status/pull/114
- https://github.com/mnbf9rca/super_simple_tfl_status/pull/115
- https://github.com/RockProfile/Django-deployment/pull/1
- https://github.com/hbmartin/graphviz2drawio/pull/83
- https://github.com/fairdataihub/codefair-app/pull/28
- https://github.com/totaldebug/atomic-calendar-revive/pull/1518
- https://github.com/iammiracle01/portfolio/pull/1
- https://github.com/iammiracle01/portfolio/pull/2
- https://github.com/iammiracle01/portfolio/pull/3
- https://github.com/supermario-ai/gpt-crawler/pull/1
- https://github.com/hbmartin/graphviz2drawio/pull/84
- https://github.com/hbmartin/graphviz2drawio/pull/85
- https://github.com/dreamerminsk/tasked/pull/85
- https://github.com/dreamerminsk/tasked/pull/86
- https://github.com/dreamerminsk/tasked/pull/84
- https://github.com/haalasz/fm-tools/pull/9
- https://github.com/haalasz/fm-tools/pull/10
- https://github.com/iptux-src/iptux/pull/619
- https://github.com/code-Harsh247/medsymptom/pull/1
- https://github.com/code-Harsh247/medsymptom/pull/2
- https://github.com/cpp-lln-lab/bidspm/pull/1263
- https://github.com/cpp-lln-lab/bidspm/pull/1264
- https://github.com/cpp-lln-lab/bidspm/pull/1265
- https://github.com/luiscarlop/Judge_AI/pull/22
- https://github.com/NoNormalCreeper/nonebot_plugin_wolfram/pull/6
- https://github.com/osama1998H/kalima/pull/39
- https://github.com/osama1998H/kalima/pull/40
- https://github.com/osama1998H/kalima/pull/41
- https://github.com/jackdewinter/pymarkdown/pull/1131
- https://github.com/Eliver-Salazar/PED/pull/12
- https://github.com/NextAlone/Nagram/pull/40
- https://github.com/strawberry-graphql/strawberry-django/pull/575
- https://github.com/strawberry-graphql/strawberry/pull/3558
- https://github.com/strawberry-graphql/strawberry/pull/3559
- https://github.com/Ruin2121/yahooquery/pull/9
- https://github.com/gdsfactory/gdsfactory/pull/2951
- https://github.com/gdsfactory/gdsfactory/pull/2954
- https://github.com/gdsfactory/gdsfactory/pull/2956
- https://github.com/gdsfactory/gdsfactory/pull/2957
- https://github.com/gdsfactory/cspdk/pull/51
review_comment_labels:
- label: correct
  question: Is this comment correct?
- label: helpful
  question: Is this comment helpful?
- label: comment-type
  question: Is the comment type correct?
- label: comment-area
  question: Is the comment area correct?
- label: llm-test
  question: |
    What type of LLM test could this comment become?
    - 👍 - this comment is really good/important and we should always make it
    - 👎 - this comment is really bad and we should never make it
    - no reaction - don't turn this comment into an LLM test

# Benchmark reviews generated by running
#   python -m scripts.experiment benchmark <experiment_name>
benchmark_reviews: []

@SourceryAI
Copy link

SourceryAI commented Jul 8, 2024

Reviewer's Guide by Sourcery

This pull request introduces a new 'Class Distribution Tool' page for managing class distributions and refactors the 'create_classes' function for better clarity. It also updates various JSON files to standardize department references and adds new custom fields to the 'Department' doctype.

File-Level Changes

Files Changes
kalima/kalima/doctype/student_scores/student_scores.json
kalima/kalima/doctype/presented_module/presented_module.json
kalima/kalima/doctype/student/student.json
kalima/kalima/doctype/class/class.json
kalima/kalima/doctype/activity_departments/activity_departments.json
kalima/kalima/doctype/applicant_student/applicant_student.json
kalima/kalima/doctype/complaints/complaints.json
kalima/kalima/doctype/constant/constant.json
kalima/kalima/doctype/continuous_exam_result/continuous_exam_result.json
kalima/kalima/doctype/department_module/department_module.json
kalima/kalima/doctype/exam_departments/exam_departments.json
kalima/kalima/doctype/exam_result_entry/exam_result_entry.json
kalima/kalima/doctype/exam_students/exam_students.json
kalima/kalima/doctype/group_class/group_class.json
kalima/kalima/doctype/library/library.json
kalima/kalima/doctype/outgoing/outgoing.json
kalima/kalima/doctype/preferred_departments/preferred_departments.json
kalima/kalima/doctype/presented_department/presented_department.json
kalima/kalima/doctype/student_attendance_entry/student_attendance_entry.json
kalima/kalima/doctype/student_result_log/student_result_log.json
kalima/kalima/doctype/students_fees/students_fees.json
kalima/kalima/doctype/transfer/transfer.json
Replaced 'Faculty Department' with 'Department' in various fields for consistency and accuracy.

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link

@SourceryAI SourceryAI left a comment

Choose a reason for hiding this comment

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

Hey @sourcery-ai-experiments-bot - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 8 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

LangSmith trace

Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

group_class_modules = json.loads(str(group_class_modules))
for module in group_class_modules:
# Convert the group_class_doc to a dictionary
group_class_doc = json.loads(str(group_class_doc))
# group_class_doc = json.loads(str(group_class_doc))

Choose a reason for hiding this comment

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

suggestion: Remove commented-out code.

The commented-out line # group_class_doc = json.loads(str(group_class_doc)) should be removed if it is no longer needed to keep the codebase clean.

Suggested change
# group_class_doc = json.loads(str(group_class_doc))
students = json.loads(str(students))

Choose a reason for hiding this comment

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

Is this comment correct?

Choose a reason for hiding this comment

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

Is this comment helpful?

Choose a reason for hiding this comment

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

Is the comment type correct?

Choose a reason for hiding this comment

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

Is the comment area correct?

Choose a reason for hiding this comment

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

What type of LLM test could this comment become?

  • 👍 - this comment is really good/important and we should always make it
  • 👎 - this comment is really bad and we should never make it
  • no reaction - don't turn this comment into an LLM test

students = json.loads(str(students))

create_class(group_class_doc["group_title"],module,group_class_doc["year"],group_class_doc["stage"],group_class_doc["semester"],group_class_doc["department"],students)
create_class(group_title,

Choose a reason for hiding this comment

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

suggestion: Consider using keyword arguments for better readability.

Using keyword arguments when calling create_class can improve readability and reduce the risk of passing arguments in the wrong order.

Suggested change
create_class(group_title,
create_class(group_title=group_title,
module=module,
year=year,
stage=stage,
semester=semester,
department=department,
students=students)
return "Classes created successfully."

Choose a reason for hiding this comment

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

Is this comment correct?

Choose a reason for hiding this comment

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

Is this comment helpful?

Choose a reason for hiding this comment

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

Is the comment type correct?

Choose a reason for hiding this comment

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

Is the comment area correct?

Choose a reason for hiding this comment

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

What type of LLM test could this comment become?

  • 👍 - this comment is really good/important and we should always make it
  • 👎 - this comment is really bad and we should never make it
  • no reaction - don't turn this comment into an LLM test

Comment on lines -19 to -30
// const selected_modules = [];
// const department = frm.doc.department;

// // Get selected modules
// frm.fields_dict.presented_modules.$wrapper.find('input[type="checkbox"]:checked').each(function () {
// selected_modules.push($(this).val());
// });

// if (selected_modules.length === 0 || !department) {
// return;
// }
// generate_classes(frm);

Choose a reason for hiding this comment

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

suggestion: Remove commented-out code.

The commented-out code in the after_save function should be removed if it is no longer needed to keep the codebase clean.

Suggested change
// const selected_modules = [];
// const department = frm.doc.department;
// // Get selected modules
// frm.fields_dict.presented_modules.$wrapper.find('input[type="checkbox"]:checked').each(function () {
// selected_modules.push($(this).val());
// });
// if (selected_modules.length === 0 || !department) {
// return;
// }
// generate_classes(frm);
after_save: function (frm) {
},

Choose a reason for hiding this comment

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

Is this comment correct?

Choose a reason for hiding this comment

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

Is this comment helpful?

Choose a reason for hiding this comment

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

Is the comment type correct?

Choose a reason for hiding this comment

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

Is the comment area correct?

Choose a reason for hiding this comment

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

What type of LLM test could this comment become?

  • 👍 - this comment is really good/important and we should always make it
  • 👎 - this comment is really bad and we should never make it
  • no reaction - don't turn this comment into an LLM test

"label": "Graduation Year"
"fieldtype": "Select",
"label": "Graduation Year",
"options": "2030\n2029\n2028\n2027\n2026\n2025\n2024\n2023\n2022\n2021\n2020\n2019\n2018\n2017\n2016\n2015\n2014\n2013\n2012\n2011\n2010"

Choose a reason for hiding this comment

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

suggestion: Consider dynamic generation of graduation years.

Instead of hardcoding the graduation years, consider generating them dynamically to avoid frequent updates.

Suggested change
"options": "2030\n2029\n2028\n2027\n2026\n2025\n2024\n2023\n2022\n2021\n2020\n2019\n2018\n2017\n2016\n2015\n2014\n2013\n2012\n2011\n2010"
"options": (() => {
const currentYear = new Date().getFullYear();
const startYear = 2010;
return Array.from({ length: currentYear - startYear + 1 }, (_, i) => currentYear - i).join('\n');
})()

Choose a reason for hiding this comment

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

Is this comment correct?

Choose a reason for hiding this comment

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

Is this comment helpful?

Choose a reason for hiding this comment

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

Is the comment type correct?

Choose a reason for hiding this comment

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

Is the comment area correct?

Choose a reason for hiding this comment

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

What type of LLM test could this comment become?

  • 👍 - this comment is really good/important and we should always make it
  • 👎 - this comment is really bad and we should never make it
  • no reaction - don't turn this comment into an LLM test

@@ -465,7 +465,8 @@ function createFormDialogNew(templateName) {
fields: [
{ fieldname: 'student_code', fieldtype: 'Data', in_list_view: 1, label: 'Student Code' },
{ fieldname: 'student_name', fieldtype: 'Link', options: 'Student', in_list_view: 1, label: 'Student Name' },
{ fieldname: 'department', fieldtype: 'Link', options: 'Faculty Department', label: 'Department' },
// { fieldname: 'department', fieldtype: 'Link', options: 'Faculty Department', label: 'Department' },
{ fieldname: 'department', fieldtype: 'Link', options: 'Department', label: 'Department' },

Choose a reason for hiding this comment

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

suggestion: Remove commented-out code.

The commented-out line // { fieldname: 'department', fieldtype: 'Link', options: 'Faculty Department', label: 'Department' }, should be removed if it is no longer needed to keep the codebase clean.

Choose a reason for hiding this comment

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

Is this comment correct?

Choose a reason for hiding this comment

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

Is this comment helpful?

Choose a reason for hiding this comment

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

Is the comment type correct?

Choose a reason for hiding this comment

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

Is the comment area correct?

Choose a reason for hiding this comment

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

What type of LLM test could this comment become?

  • 👍 - this comment is really good/important and we should always make it
  • 👎 - this comment is really bad and we should never make it
  • no reaction - don't turn this comment into an LLM test

@@ -14,7 +14,7 @@ frappe.pages['student-portal'].on_page_load = async function (wrapper) {
var $container = $(wrapper).find('.layout-main-section');
$container.html(main_template);

await get_current_user_student();
// await get_current_user_student();

Choose a reason for hiding this comment

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

suggestion: Remove commented-out code.

The commented-out line // await get_current_user_student(); should be removed if it is no longer needed to keep the codebase clean.

Suggested change
// await get_current_user_student();
await get_classes();
await content_manager();

Choose a reason for hiding this comment

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

Is this comment correct?

Choose a reason for hiding this comment

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

Is this comment helpful?

Choose a reason for hiding this comment

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

Is the comment type correct?

Choose a reason for hiding this comment

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

Is the comment area correct?

Choose a reason for hiding this comment

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

What type of LLM test could this comment become?

  • 👍 - this comment is really good/important and we should always make it
  • 👎 - this comment is really bad and we should never make it
  • no reaction - don't turn this comment into an LLM test

fieldtype: 'Link',
fieldname: 'department',
label: 'Department',
// options: 'Faculty Department',

Choose a reason for hiding this comment

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

suggestion: Remove commented-out code.

The commented-out line // options: 'Faculty Department', should be removed if it is no longer needed to keep the codebase clean.

Choose a reason for hiding this comment

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

Is this comment correct?

Choose a reason for hiding this comment

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

Is this comment helpful?

Choose a reason for hiding this comment

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

Is the comment type correct?

Choose a reason for hiding this comment

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

Is the comment area correct?

Choose a reason for hiding this comment

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

What type of LLM test could this comment become?

  • 👍 - this comment is really good/important and we should always make it
  • 👎 - this comment is really bad and we should never make it
  • no reaction - don't turn this comment into an LLM test

callback: function (r) {
if (r.message) {
// Determine the number of tables and rows per table
let studentsPerTable = Math.ceil(r.message.length / 3);

Choose a reason for hiding this comment

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

suggestion: Consider making the number of tables configurable.

Instead of hardcoding the number of tables to 3, consider making it a configurable parameter to allow for flexibility.

Suggested change
let studentsPerTable = Math.ceil(r.message.length / 3);
let numberOfTables = 3; // This can be made configurable
let studentsPerTable = Math.ceil(r.message.length / numberOfTables);

Choose a reason for hiding this comment

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

Is this comment correct?

Choose a reason for hiding this comment

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

Is this comment helpful?

Choose a reason for hiding this comment

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

Is the comment type correct?

Choose a reason for hiding this comment

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

Is the comment area correct?

Choose a reason for hiding this comment

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

What type of LLM test could this comment become?

  • 👍 - this comment is really good/important and we should always make it
  • 👎 - this comment is really bad and we should never make it
  • no reaction - don't turn this comment into an LLM test

This was referenced Jul 8, 2024
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