adds option to set paper status when adding dummy papers
This commit is contained in:
parent
4f0539f4b0
commit
74e713e8a6
@ -278,6 +278,16 @@ def generate_test_papers():
|
|||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
paper_count = 100
|
paper_count = 100
|
||||||
|
|
||||||
|
# Get the status settings
|
||||||
|
try:
|
||||||
|
dummy_paper_status = request.form.get("dummy_paper_status")
|
||||||
|
if dummy_paper_status == "new":
|
||||||
|
dummy_paper_status = "New"
|
||||||
|
else:
|
||||||
|
dummy_paper_status = random.choice(["New","Pending", "Done", "Failed"])
|
||||||
|
except (ValueError, TypeError):
|
||||||
|
dummy_paper_status = random.choice(["New","Pending", "Done", "Failed"])
|
||||||
|
|
||||||
# Get the download path for file paths
|
# Get the download path for file paths
|
||||||
download_path = DownloadPathConfig.get_path()
|
download_path = DownloadPathConfig.get_path()
|
||||||
|
|
||||||
@ -320,7 +330,7 @@ def generate_test_papers():
|
|||||||
type=random.choice(paper_types),
|
type=random.choice(paper_types),
|
||||||
language=random.choice(languages),
|
language=random.choice(languages),
|
||||||
published_online=pub_date.date(),
|
published_online=pub_date.date(),
|
||||||
status=random.choice(["Pending", "Done", "Failed"]),
|
status=dummy_paper_status,
|
||||||
file_path=f"{download_path}/test_paper_{i+1}.pdf" if random.random() > 0.3 else None,
|
file_path=f"{download_path}/test_paper_{i+1}.pdf" if random.random() > 0.3 else None,
|
||||||
error_msg="Download failed: connection timeout" if random.random() < 0.1 else None,
|
error_msg="Download failed: connection timeout" if random.random() < 0.1 else None,
|
||||||
created_at=datetime.now() - timedelta(days=random.randint(0, 30))
|
created_at=datetime.now() - timedelta(days=random.randint(0, 30))
|
||||||
|
@ -33,6 +33,17 @@
|
|||||||
<small class="form-text text-muted">Enter a number between 1 and
|
<small class="form-text text-muted">Enter a number between 1 and
|
||||||
1000</small>
|
1000</small>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="dummy_paper_status" class="col-sm-3 col-form-label">Paper
|
||||||
|
Status:</label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<select id="dummy_paper_status" class="form-control"
|
||||||
|
name="dummy_paper_status">
|
||||||
|
<option value="new">New Only</option>
|
||||||
|
<option value="mixed-random">Randomly Mixed</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
<div class="col-sm-5">
|
<div class="col-sm-5">
|
||||||
<button type="submit" class="btn btn-primary">
|
<button type="submit" class="btn btn-primary">
|
||||||
<i class="fas fa-plus-circle"></i> Generate Test Papers
|
<i class="fas fa-plus-circle"></i> Generate Test Papers
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
<div class="container mt-4">
|
<div class="container mt-4">
|
||||||
<h1>Configuration</h1>
|
<h1>Configuration</h1>
|
||||||
|
|
||||||
<ul class="nav nav-pills mb-4">
|
<ul class="nav nav-pills nav-fill mb-4">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link {% if active_tab == 'general' %}active{% endif %}"
|
<a class="nav-link {% if active_tab == 'general' %}active{% endif %}"
|
||||||
href="{{ url_for('config.general') }}">General</a>
|
href="{{ url_for('config.general') }}">General</a>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user