diff --git a/README.md b/README.md index f77ddfe8..1a94421f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

- Frappe LMS + Frappe LMS

Easy to use, open source, learning management system.

diff --git a/lms/hooks.py b/lms/hooks.py index 0e2b3adf..f4cf919d 100644 --- a/lms/hooks.py +++ b/lms/hooks.py @@ -173,7 +173,8 @@ website_route_rules = [ "to_route": "cohorts/join", }, {"from_route": "/users", "to_route": "profiles/profile"}, - {"from_route": "/jobs/", "to_route": "jobs/job"}, + {"from_route": "/job-openings", "to_route": "jobs_openings/index"}, + {"from_route": "/job-openings/", "to_route": "jobs_openings/job"}, { "from_route": "/batches//students/", "to_route": "/batches/progress", diff --git a/lms/install.py b/lms/install.py index cd74c28d..e77b577c 100644 --- a/lms/install.py +++ b/lms/install.py @@ -19,7 +19,7 @@ def add_pages_to_nav(): {"label": "Courses", "url": "/courses", "parent": "Explore", "idx": 2}, {"label": "Batches", "url": "/batches", "parent": "Explore", "idx": 3}, {"label": "Statistics", "url": "/statistics", "parent": "Explore", "idx": 4}, - {"label": "Jobs", "url": "/jobs", "parent": "Explore", "idx": 5}, + {"label": "Jobs", "url": "/job-openings", "parent": "Explore", "idx": 5}, {"label": "People", "url": "/community", "parent": "Explore", "idx": 6}, ] diff --git a/lms/job/doctype/job_opportunity/job_opportunity.js b/lms/job/doctype/job_opportunity/job_opportunity.js index e82daaa7..bfc6891f 100644 --- a/lms/job/doctype/job_opportunity/job_opportunity.js +++ b/lms/job/doctype/job_opportunity/job_opportunity.js @@ -4,6 +4,6 @@ frappe.ui.form.on("Job Opportunity", { refresh: (frm) => { if (frm.doc.name) - frm.add_web_link(`/jobs/${frm.doc.name}`, "See on Website"); + frm.add_web_link(`/job-openings/${frm.doc.name}`, "See on Website"); }, }); diff --git a/lms/job/web_form/job_opportunity/job_opportunity.js b/lms/job/web_form/job_opportunity/job_opportunity.js index ac3bce91..dca594ee 100644 --- a/lms/job/web_form/job_opportunity/job_opportunity.js +++ b/lms/job/web_form/job_opportunity/job_opportunity.js @@ -1,7 +1,7 @@ frappe.ready(function () { frappe.web_form.after_save = () => { setTimeout(() => { - window.location.href = `/jobs`; + window.location.href = `/job-openings`; }); }; }); diff --git a/lms/job/web_form/job_opportunity/job_opportunity.json b/lms/job/web_form/job_opportunity/job_opportunity.json index f54dc557..07800661 100644 --- a/lms/job/web_form/job_opportunity/job_opportunity.json +++ b/lms/job/web_form/job_opportunity/job_opportunity.json @@ -20,7 +20,7 @@ "list_columns": [], "login_required": 1, "max_attachment_size": 0, - "modified": "2022-09-15 17:22:43.957184", + "modified": "2022-09-15 17:22:43.957185", "modified_by": "Administrator", "module": "Job", "name": "job-opportunity", @@ -32,7 +32,7 @@ "show_list": 1, "show_sidebar": 0, "success_message": "", - "success_url": "/jobs", + "success_url": "/job-openings", "title": "Job Opportunity", "web_form_fields": [ { diff --git a/lms/lms/doctype/lms_certificate_request/lms_certificate_request.py b/lms/lms/doctype/lms_certificate_request/lms_certificate_request.py index 9b33ed99..3f1039fa 100644 --- a/lms/lms/doctype/lms_certificate_request/lms_certificate_request.py +++ b/lms/lms/doctype/lms_certificate_request/lms_certificate_request.py @@ -11,8 +11,20 @@ from lms.lms.utils import get_evaluator class LMSCertificateRequest(Document): def validate(self): + self.validate_slot() self.validate_if_existing_requests() - self.validate_evaluation_date() + self.validate_evaluation_end_date() + + def validate_slot(self): + if frappe.db.exists( + "LMS Certificate Request", + { + "evaluator": self.evaluator, + "date": self.date, + "start_time": self.start_time, + }, + ): + frappe.throw(_("The slot is already booked by another participant.")) def validate_if_existing_requests(self): existing_requests = frappe.get_all( @@ -33,19 +45,19 @@ class LMSCertificateRequest(Document): ) ) - def validate_evaluation_date(self): + def validate_evaluation_end_date(self): if self.batch_name: evaluation_end_date = frappe.db.get_value( "LMS Batch", self.batch_name, "evaluation_end_date" ) - if evaluation_end_date: - if getdate(self.date) > getdate(evaluation_end_date): - frappe.throw( - _("You cannot schedule evaluations after {0}.").format( - format_date(evaluation_end_date, "medium") + if evaluation_end_date: + if getdate(self.date) > getdate(evaluation_end_date): + frappe.throw( + _("You cannot schedule evaluations after {0}.").format( + format_date(evaluation_end_date, "medium") + ) ) - ) def schedule_evals(): diff --git a/lms/patches.txt b/lms/patches.txt index 4e9db712..85d1485c 100644 --- a/lms/patches.txt +++ b/lms/patches.txt @@ -81,4 +81,5 @@ lms.patches.v1_0.create_batch_source [post_model_sync] lms.patches.v1_0.batch_tabs_settings -execute:frappe.delete_doc("Notification", "Assignment Submission Notification") \ No newline at end of file +execute:frappe.delete_doc("Notification", "Assignment Submission Notification") +lms.patches.v1_0.change_jobs_url #17-01-2024 \ No newline at end of file diff --git a/lms/patches/v1_0/change_jobs_url.py b/lms/patches/v1_0/change_jobs_url.py new file mode 100644 index 00000000..c7b3c673 --- /dev/null +++ b/lms/patches/v1_0/change_jobs_url.py @@ -0,0 +1,15 @@ +import frappe + + +def execute(): + jobs_link = frappe.db.exists( + "Top Bar Item", + { + "label": "Jobs", + "url": "/jobs", + "parent_label": "Explore", + }, + ) + + if jobs_link: + frappe.db.set_value("Top Bar Item", jobs_link, "url", "/job-openings") diff --git a/lms/public/images/lms-logo.png b/lms/public/images/lms-logo.png new file mode 100644 index 00000000..94ba662b Binary files /dev/null and b/lms/public/images/lms-logo.png differ diff --git a/lms/www/batches/index.html b/lms/www/batches/index.html index 0e18eb46..60eaad4f 100644 --- a/lms/www/batches/index.html +++ b/lms/www/batches/index.html @@ -147,7 +147,7 @@ -
+
diff --git a/lms/www/jobs/__init__.py b/lms/www/jobs_openings/__init__.py similarity index 100% rename from lms/www/jobs/__init__.py rename to lms/www/jobs_openings/__init__.py diff --git a/lms/www/jobs/index.html b/lms/www/jobs_openings/index.html similarity index 91% rename from lms/www/jobs/index.html rename to lms/www/jobs_openings/index.html index da82e70f..4d2642f8 100644 --- a/lms/www/jobs/index.html +++ b/lms/www/jobs_openings/index.html @@ -17,7 +17,8 @@
{% for job in jobs %}
-
{{ _(job.job_title) }}
@@ -37,7 +38,7 @@
{{ frappe.utils.format_date(job.creation, "medium") }}
- +
{% endfor %}
diff --git a/lms/www/jobs/index.py b/lms/www/jobs_openings/index.py similarity index 100% rename from lms/www/jobs/index.py rename to lms/www/jobs_openings/index.py diff --git a/lms/www/jobs/job.html b/lms/www/jobs_openings/job.html similarity index 94% rename from lms/www/jobs/job.html rename to lms/www/jobs_openings/job.html index 9e1db41c..f2b65889 100644 --- a/lms/www/jobs/job.html +++ b/lms/www/jobs_openings/job.html @@ -11,7 +11,8 @@
-
@@ -33,7 +34,7 @@
- {% set application_link = job.application_link if frappe.session.user != 'Guest' else '/login?redirect-to=/jobs/' + job.name %} + {% set application_link = job.application_link if frappe.session.user != 'Guest' else '/login?redirect-to=/job-openings/' + job.name %}
{{ _("Apply") }}
{{ _("Report") }}
@@ -94,7 +95,7 @@ {% macro BreadCrumb(job) %} diff --git a/lms/www/jobs/job.js b/lms/www/jobs_openings/job.js similarity index 92% rename from lms/www/jobs/job.js rename to lms/www/jobs_openings/job.js index 19a81e52..b776adbb 100644 --- a/lms/www/jobs/job.js +++ b/lms/www/jobs_openings/job.js @@ -11,7 +11,7 @@ frappe.ready(() => { const open_report_dialog = (e) => { e.preventDefault(); if (frappe.session.user == "Guest") { - window.location.href = `/login?redirect-to=/jobs/${$( + window.location.href = `/login?redirect-to=/job-openings/${$( e.currentTarget ).data("job")}`; return; diff --git a/lms/www/jobs/job.py b/lms/www/jobs_openings/job.py similarity index 89% rename from lms/www/jobs/job.py rename to lms/www/jobs_openings/job.py index 5d91c4bd..d5746d3f 100644 --- a/lms/www/jobs/job.py +++ b/lms/www/jobs_openings/job.py @@ -5,7 +5,7 @@ def get_context(context): try: job = frappe.form_dict["job"] except KeyError: - frappe.local.flags.redirect_location = "/jobs" + frappe.local.flags.redirect_location = "/job-openings" raise frappe.Redirect context.job = frappe.get_doc("Job Opportunity", job)