Skip to content

Commit

Permalink
Random result for sheet (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
kozleek authored Jun 19, 2024
1 parent c95850c commit 22ac940
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 0 additions & 1 deletion app/Observers/SheetObserver.php
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@ class SheetObserver

function created(Sheet $sheet)
{
// generate a random placeholder name for the sheet
$sheet->fingerprint = RandomSupport::getRandomCode($sheet->id, 4);
$sheet->save();
}
11 changes: 10 additions & 1 deletion app/Support/KitSupport.php
Original file line number Diff line number Diff line change
@@ -276,9 +276,18 @@ public static function saveKitData($data, $kit = null): Kit
$kit->sheets()->delete(); // Smažeme staré listy, pokud existují

foreach (range(1, $data['countSheets']) as $i) {

// generate random example and result
$example = ExampleSupport::getExample(
$data['countNumbers'],
$rangeNumbers,
$rangeOperations,
$settingsExamples
);

$sheet = $kit->sheets()->create([
'code' => $i,
'result' => RandomSupport::getRandomNumber($rangeNumbers),
'result' => $example['result']
]);

// Create examples for the sheet

0 comments on commit 22ac940

Please sign in to comment.