Skip to content

Commit 5393447

Browse files
committed
- Merge branch 'staging'
- Add command to reset total questions asked at the beginning of the month.
2 parents 763a037 + a1b2c6e commit 5393447

File tree

7 files changed

+65
-30
lines changed

7 files changed

+65
-30
lines changed
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use App\Models\User;
6+
use Illuminate\Console\Command;
7+
8+
class ResetQuestions extends Command
9+
{
10+
protected $signature = 'venture:reset-questions';
11+
12+
protected $description = 'This command resets the total questions asked column each month, giving the user 20 free questions to ask each month.';
13+
14+
public function handle()
15+
{
16+
User::whereNull('parent_id')->chunk(100, function ($users) {
17+
foreach ($users as $user) {
18+
$startOfMonth = now($user->timezone)->startOfMonth();
19+
20+
if ($startOfMonth->isToday()) {
21+
$user->update([
22+
'total_questions_asked' => 0,
23+
]);
24+
}
25+
}
26+
});
27+
}
28+
}

app/Console/Kernel.php

+1-6
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,12 @@
88

99
class Kernel extends ConsoleKernel
1010
{
11-
/**
12-
* Define the application's command schedule.
13-
*/
1411
protected function schedule(Schedule $schedule): void
1512
{
1613
$schedule->job(new CleanUpActiveTime())->everyMinute();
14+
$schedule->command('venture:reset-questions')->dailyAt('00:05');
1715
}
1816

19-
/**
20-
* Register the commands for the application.
21-
*/
2217
protected function commands(): void
2318
{
2419
$this->load(__DIR__.'/Commands');

resources/js/Layouts/AuthenticatedLayout.vue

+2
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,8 @@ const isOnboarding = () => {
319319
};
320320
321321
const getQueryStatus = () => {
322+
if (isServer) return;
323+
322324
return new URLSearchParams(window.location.search).get('status');
323325
};
324326

resources/js/Pages/Dashboard.vue

+10-8
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,18 @@ const isDarkMode = ref(false);
138138
onMounted(() => {
139139
isClient.value = true;
140140
141-
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {
142-
isDarkMode.value = e.matches;
143-
chartOptions.value = {
144-
title: {
145-
style: {
146-
color: e.matches ? '#a3a3a3' : '#0a0a0a',
141+
if (isClient.value) {
142+
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {
143+
isDarkMode.value = e.matches;
144+
chartOptions.value = {
145+
title: {
146+
style: {
147+
color: e.matches ? '#a3a3a3' : '#0a0a0a',
148+
}
147149
}
148150
}
149-
}
150-
});
151+
});
152+
}
151153
});
152154
153155
const series = ref([

resources/js/Pages/Student/Dashboard.vue

+10-8
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,18 @@ const isDarkMode = ref(false);
213213
onMounted(() => {
214214
isClient.value = true;
215215
216-
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {
217-
isDarkMode.value = e.matches;
218-
chartOptions.value = {
219-
title: {
220-
style: {
221-
color: e.matches ? '#a3a3a3' : '#0a0a0a',
216+
if (isClient.value) {
217+
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {
218+
isDarkMode.value = e.matches;
219+
chartOptions.value = {
220+
title: {
221+
style: {
222+
color: e.matches ? '#a3a3a3' : '#0a0a0a',
223+
}
222224
}
223225
}
224-
}
225-
});
226+
});
227+
}
226228
});
227229
228230
const series = ref([

resources/js/Pages/Teachers/Students/Create.vue

+4
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ const form = useForm({
123123
timezone: '',
124124
});
125125
126+
const isServer = typeof window === 'undefined'
127+
126128
const submit = () => {
127129
form.transform((data) => ({
128130
...data,
@@ -140,6 +142,8 @@ const isOnboarding = () => {
140142
};
141143
142144
const getQueryStatus = () => {
145+
if (isServer) return;
146+
143147
return new URLSearchParams(window.location.search).get('status');
144148
};
145149
</script>

resources/js/Pages/Teachers/Students/Show.vue

+10-8
Original file line numberDiff line numberDiff line change
@@ -204,16 +204,18 @@ const handleTimeframeChange = () => {
204204
onMounted(() => {
205205
isClient.value = true;
206206
207-
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {
208-
isDarkMode.value = e.matches;
209-
chartOptions.value = {
210-
title: {
211-
style: {
212-
color: e.matches ? '#a3a3a3' : '#0a0a0a',
207+
if (isClient.value) {
208+
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {
209+
isDarkMode.value = e.matches;
210+
chartOptions.value = {
211+
title: {
212+
style: {
213+
color: e.matches ? '#a3a3a3' : '#0a0a0a',
214+
}
213215
}
214216
}
215-
}
216-
});
217+
});
218+
}
217219
});
218220
219221
const series = ref([

0 commit comments

Comments
 (0)