feat [P-227]: убрал ненужный delete
This commit is contained in:
1 parent
332260113c
commit
3724cdde8d
1 file changed
+1
-24
@@ -123,30 +123,7 @@ export default {
|
||||
return `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
|
||||
});
|
||||
|
||||
const deactivateOldTestings = async (testId) => {
|
||||
try {
|
||||
const testingResp = await axiosApiInstance.get(`/api/tests/testingview/?test_id=${testId}`);
|
||||
const userTestings = testingResp.data;
|
||||
|
||||
if (userTestings?.length > 1) {
|
||||
const sortedTestings = [...userTestings].sort((a, b) => {
|
||||
return new Date(b.completion_date) - new Date(a.completion_date);
|
||||
});
|
||||
|
||||
for (let i = 1; i < sortedTestings.length; i++) {
|
||||
await axiosApiInstance.delete(`/api/tests/testingview/`, {
|
||||
data: { id: sortedTestings[i].id }
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error deactivating old testings:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const startTest = async () => {
|
||||
await deactivateOldTestings(testId);
|
||||
|
||||
const startTest = async () => {
|
||||
await getTestById(testId);
|
||||
|
||||
testStarted.value = true;
|
||||
|
||||
Reference in new issue
Block a user