Skip to content

Commit

Permalink
Fixed api issues
Browse files Browse the repository at this point in the history
  • Loading branch information
felder101 committed Dec 17, 2024
1 parent 38a6647 commit 104af8b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
29 changes: 29 additions & 0 deletions training-front-end/src/components/ReportRepository.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<script>
import {useStore} from "@nanostores/vue";
import {profile} from "../stores/user.js";
const user = useStore(profile)
const base_url = import.meta.env.PUBLIC_API_BASE_URL
const downloadTrainingCompletionReport = async function(filterData){
const response = await fetch(`${base_url}/api/v1/users/download-smartpay-training-report`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${user.value.jwt}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(filterData)
});
if (!response.ok) {
const message = await response.text()
throw new Error(message)
}
return await response //needs to be returned as raw not json
}
export default {
downloadTrainingCompletionReport
}
</script>
1 change: 0 additions & 1 deletion training/repositories/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ def get_user_quiz_completion_report(self, filter: SmartPayTrainingReportFilter,
.join(models.QuizCompletion)
.join(models.Quiz)
.filter(models.QuizCompletion.passed)
.order_by(models.Agency.name.asc(), nullsfirst(models.Agency.bureau.asc()), models.QuizCompletion.submit_ts.desc()).all()
)

if report_user and report_user.report_agencies:
Expand Down

0 comments on commit 104af8b

Please sign in to comment.