Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
9069f751c3
|
|||
|
472956c76d
|
|||
|
27c275bccb
|
|||
|
f89a031997
|
|||
| 8033b498f9 |
@@ -6,7 +6,7 @@ jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v7
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
@@ -20,15 +20,7 @@ jobs:
|
||||
pytest:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Update docker-compose
|
||||
uses: KengoTODA/actions-setup-docker-compose@v1
|
||||
with:
|
||||
version: "2.28.0"
|
||||
- uses: actions/checkout@v7
|
||||
- name: run tests
|
||||
run: docker compose run --build --rm api pytest -vv
|
||||
- name: show logs
|
||||
|
||||
+4
-3
@@ -49,13 +49,14 @@ services:
|
||||
migrator:
|
||||
<<: *main_app
|
||||
restart: "no"
|
||||
command: piccolo migrations forwards all
|
||||
command:
|
||||
- bash
|
||||
- -c
|
||||
- "ls && piccolo migrations forwards all"
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
|
||||
|
||||
|
||||
volumes:
|
||||
zangramru-db-data:
|
||||
name: zangramru-db-data
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
from piccolo.apps.migrations.auto.migration_manager import MigrationManager
|
||||
from piccolo.columns.column_types import Integer
|
||||
|
||||
ID = "2026-07-02T12:57:47:552419"
|
||||
VERSION = "1.34.0"
|
||||
DESCRIPTION = ""
|
||||
|
||||
|
||||
async def forwards():
|
||||
manager = MigrationManager(
|
||||
migration_id=ID, app_name="zangramru_db", description=DESCRIPTION
|
||||
)
|
||||
|
||||
manager.alter_column(
|
||||
table_class_name="Puzzle",
|
||||
tablename="puzzle",
|
||||
column_name="number",
|
||||
db_column_name="number",
|
||||
params={"unique": True},
|
||||
old_params={"unique": False},
|
||||
column_class=Integer,
|
||||
old_column_class=Integer,
|
||||
schema=None,
|
||||
)
|
||||
|
||||
return manager
|
||||
@@ -12,4 +12,4 @@ class Puzzle(Table):
|
||||
solutions = JSON()
|
||||
extra = JSON()
|
||||
definitions = JSON()
|
||||
number = Integer()
|
||||
number = Integer(unique=True)
|
||||
|
||||
+13475
-3629
File diff suppressed because it is too large
Load Diff
@@ -403,7 +403,7 @@
|
||||
const cctx = confettiCanvas.getContext('2d');
|
||||
|
||||
// ===================== Constants =====================
|
||||
const CELL = 70, GAP = 20, GRID = 4, PITCH = CELL + GAP, SH = 5;
|
||||
const CELL = 70, GAP = 30, GRID = 4, PITCH = CELL + GAP, SH = 5;
|
||||
const ENTRANCE_DUR = 360, ENTRANCE_STAGGER = 42, PULSE_DUR = 520;
|
||||
const PALETTE = [
|
||||
'#ff3d81','#ffd400','#00e0c6','#7c5cff','#54a0ff',
|
||||
@@ -560,7 +560,7 @@
|
||||
// ===================== Rendering =====================
|
||||
function drawConnections() {
|
||||
const p = PAL();
|
||||
ctx.strokeStyle = p.line; ctx.lineWidth = GAP - 4; ctx.lineCap = 'round';
|
||||
ctx.strokeStyle = p.line; ctx.lineWidth = 8; ctx.lineCap = 'round';
|
||||
ctx.beginPath();
|
||||
for (const key of getActiveConnections()) {
|
||||
const [ka, kb] = key.split('-');
|
||||
@@ -576,7 +576,7 @@
|
||||
function drawSelectionLine(color) {
|
||||
if (selected.length < 2) return;
|
||||
const t1 = CELL / (2 * PITCH), t2 = 1 - t1;
|
||||
ctx.strokeStyle = color; ctx.lineWidth = GAP - 2; ctx.lineCap = 'round'; ctx.lineJoin = 'round';
|
||||
ctx.strokeStyle = color; ctx.lineWidth = 10; ctx.lineCap = 'round'; ctx.lineJoin = 'round';
|
||||
ctx.beginPath();
|
||||
for (let i = 0; i < selected.length - 1; i++) {
|
||||
const c1 = cellCenter(selected[i][0], selected[i][1]);
|
||||
@@ -706,7 +706,7 @@
|
||||
'<span class="word-text">' + word + '</span>' +
|
||||
(isExtra ? '<span class="word-tag">бонус</span>' : '') +
|
||||
'</div>' +
|
||||
(def ? '<span class="word-def">— ' + def + '</span>' : '');
|
||||
(def ? '<span class="word-def">' + def.replace(/\n/g, '<br>') + '</span>' : '');
|
||||
grid.appendChild(item);
|
||||
}
|
||||
foundDiv.appendChild(grid);
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 26 KiB |
@@ -1,3 +1,4 @@
|
||||
import asyncio
|
||||
import json
|
||||
from datetime import date, timedelta
|
||||
|
||||
@@ -30,7 +31,7 @@ async def daily_puzzle(
|
||||
# Because they start at one, so we need to subtract one.
|
||||
target_date = date.today()
|
||||
if number is not None:
|
||||
target_date = settings.start_date + timedelta(days=number - 1)
|
||||
target_date = settings.start_date + timedelta(days=number)
|
||||
|
||||
if target_date > date.today():
|
||||
raise HTTPException(
|
||||
@@ -45,13 +46,15 @@ async def daily_puzzle(
|
||||
if daily_puzzle is not None:
|
||||
board = [list(daily_puzzle.board[i * 4 : i * 4 + 4]) for i in range(4)]
|
||||
return DailyPuzzleDTO(
|
||||
number=(date.today() - settings.start_date).days,
|
||||
number=daily_puzzle.number,
|
||||
board=board,
|
||||
solutions=json.loads(daily_puzzle.solutions),
|
||||
extra=json.loads(daily_puzzle.extra),
|
||||
word_defs=json.loads(daily_puzzle.definitions),
|
||||
)
|
||||
puzzle = generator.generate(target=10)
|
||||
|
||||
loop = asyncio.get_running_loop()
|
||||
puzzle = await loop.run_in_executor(None, generator.generate, 10)
|
||||
compressedboard = "".join("".join(row) for row in puzzle.board)
|
||||
await Puzzle(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user