Skip to content

Commit

Permalink
Merge pull request #1265 from pateljannat/issues-70
Browse files Browse the repository at this point in the history
fix: jobs page rendering issue for guest users
  • Loading branch information
pateljannat authored Jan 22, 2025
2 parents ed8baf3 + 1ac5de9 commit a28227a
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 26 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/ProgressBar.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<Tooltip :text="`${props.progress}%`">
<div class="w-full bg-gray-200 rounded-full h-1 my-2">
<div class="w-full bg-gray-200 rounded-full h-1">
<div
class="bg-gray-900 rounded-full"
:class="progressBarHeight"
Expand Down
13 changes: 8 additions & 5 deletions frontend/src/components/Quiz.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@
</div>
</div>

<div v-if="quiz.data.duration" class="flex items-center space-x-2 my-4">
<span class="text-gray-600 text-xs"> {{ __('Time') }}: </span>
<div v-if="quiz.data.duration" class="flex flex-col space-x-1 my-4">
<div class="mb-2">
<span class=""> {{ __('Time') }}: </span>
<span class="font-semibold">
{{ formatTimer(timer) }}
</span>
</div>
<ProgressBar :progress="timerProgress" />
<span class="font-semibold">
{{ formatTimer(timer) }}
</span>
</div>

<div v-if="activeQuestion == 0">
Expand Down Expand Up @@ -590,6 +592,7 @@ const getInstructions = (question) => {
}
const markLessonProgress = () => {
console.log(router)
if (router.currentRoute.value.name == 'Lesson') {
call('lms.lms.api.mark_lesson_progress', {
course: router.currentRoute.value.params.courseName,
Expand Down
28 changes: 11 additions & 17 deletions frontend/src/pages/Jobs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
</div>
</template>
<script setup>
import { Button, Breadcrumbs, createListResource, FormControl } from 'frappe-ui'
import { Button, Breadcrumbs, createResource, FormControl } from 'frappe-ui'
import { Plus, Search } from 'lucide-vue-next'
import { inject, computed, ref, onMounted } from 'vue'
import JobCard from '@/components/JobCard.vue'
Expand All @@ -101,32 +101,26 @@ onMounted(() => {
updateJobs()
})
const jobs = createListResource({
doctype: 'Job Opportunity',
fields: [
'name',
'job_title',
'company_name',
'company_logo',
'location',
'type',
'creation',
],
start: 0,
pageLength: 20,
cache: ['jobOpportunities'],
const jobs = createResource({
url: 'lms.lms.api.get_job_opportunities',
cache: ['jobs'],
})
const updateJobs = () => {
updateFilters()
jobs.update({
filters: filters.value,
orFilters: orFilters.value,
params: {
filters: filters.value,
orFilters: orFilters.value,
},
})
jobs.reload()
}
const updateFilters = () => {
filters.value.status = 'Open'
filters.value.disabled = 0
if (jobType.value) {
filters.value.type = jobType.value
} else {
Expand Down
18 changes: 15 additions & 3 deletions lms/lms/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,23 @@ def get_job_details(job):


@frappe.whitelist(allow_guest=True)
def get_job_opportunities():
def get_job_opportunities(filters=None, orFilters=None):
if not filters:
filters = {}

jobs = frappe.get_all(
"Job Opportunity",
{"status": "Open", "disabled": False},
["job_title", "location", "type", "company_name", "company_logo", "name", "creation"],
filters=filters,
or_filters=orFilters,
fields=[
"job_title",
"location",
"type",
"company_name",
"company_logo",
"name",
"creation",
],
order_by="creation desc",
)
return jobs
Expand Down

0 comments on commit a28227a

Please sign in to comment.