Merge branch 'cleanup' of github.com:GeoDash897/place-atlas into cleanup

This commit is contained in:
GeoDash897 2022-05-18 20:58:14 -04:00
commit f1d20629b6
6 changed files with 8161 additions and 8158 deletions

View file

@ -9715,9 +9715,21 @@ ui1nsg
uhwzjt
uhw2h0
uj1yb5
up28w9
up208s
up7z2o
up58ba
up3yfl
up3ty4
up28w9
up208s
up7z2o
up58ba
up3yfl
up3ty4
uqixxl
uqgttl
uqg3it
upzg49
urripm
usn581
usn14a
usmv6w
usmfke
usmdg8
usm0g8
uslwi8

View file

@ -2,9 +2,16 @@
import re
import json
import math
import traceback
from typing import List
END_NORMAL_IMAGE = "164"
END_WHITEOUT_IMAGE = "166"
NORMAL_IMAGE_SUFFIX = "-" + END_NORMAL_IMAGE
WHITEOUT_IMAGE_SUFFIX = "-" + END_WHITEOUT_IMAGE
"""
Examples:
1. - /r/place
@ -282,11 +289,6 @@ def extend_entries_to_whiteout(entry: dict):
"""
If an entry ends on the final non-whiteout image, extends the image to the last whiteout image where entries cans still be made out.
"""
END_NORMAL_IMAGE = "164"
END_WHITEOUT_IMAGE = "166"
NORMAL_IMAGE_SUFFIX = "-" + END_NORMAL_IMAGE
WHITEOUT_IMAGE_SUFFIX = "-" + END_WHITEOUT_IMAGE
for outer_key in ["path", "center"]:
image_keys: List[str] = list(entry[outer_key].keys())
for image_key in image_keys:
@ -300,6 +302,24 @@ def extend_entries_to_whiteout(entry: dict):
return entry
def floor_points(entry: dict):
"""
Floors points on path and center, removing the decimal count.
"""
for period in entry["path"]:
for points in entry["path"][period]:
points[0] = math.floor(points[0])
points[1] = math.floor(points[1])
for period in entry["center"]:
points = entry["center"][period]
points[0] = math.floor(points[0])
points[1] = math.floor(points[1])
return entry
def validate(entry: dict):
"""
Validates the entry. Catch errors and tell warnings related to the entry.
@ -385,6 +405,9 @@ def print_(*args, **kwargs):
entry = sort_image_keys(entry)
print_("Extending entries to whiteout...")
entry = extend_entries_to_whiteout(entry)
print_("Flooring points...")
entry = floor_points(entry)
print_("Validating...")
status_code = validate(entry)
print_("Completed!")

View file

@ -270,8 +270,8 @@ function initDraw() {
pathWithPeriodsTemp.forEach(([key, value]) => {
// TODO: Compress periods on something like 0-13, 14.
exportObject.path[key] = value
exportObject.center[key] = calculateCenter(value)
exportObject.path[key] = value.map(point => point.map(int => int - 0.5))
exportObject.center[key] = calculateCenter(value).map(int => int - 0.5)
})
const inputWebsite = websiteGroupElements.map(element => element.value.trim()).filter(element => element)

View file

@ -516,39 +516,24 @@ async function init() {
function updateAtlasAll(atlas = atlasAll) {
for (const atlasIndex in atlas) {
if (Array.isArray(atlas[atlasIndex].path)) {
const currentPath = atlas[atlasIndex].path
atlas[atlasIndex].path = {}
atlas[atlasIndex].path[defaultPeriod] = currentPath
const currentLinks = atlas[atlasIndex].links
atlas[atlasIndex].links = {
website: [],
subreddit: [],
discord: [],
wiki: [],
...currentLinks
}
if (Array.isArray(atlas[atlasIndex].center)) {
const currentCenter = atlas[atlasIndex].center
atlas[atlasIndex].center = {}
atlas[atlasIndex].center[defaultPeriod] = currentCenter
const currentPath = atlas[atlasIndex].path
const currentCenter = atlas[atlasIndex].center
for (const key in currentPath) {
currentPath[key] = currentPath[key].map(point => point.map(int => int + 0.5))
}
if (atlas[atlasIndex].links) {
const currentLinks = atlas[atlasIndex].links
atlas[atlasIndex].links = {
website: [],
subreddit: [],
discord: [],
wiki: [],
...currentLinks
}
} else {
atlas[atlasIndex].links = {
website: [],
subreddit: [],
discord: [],
wiki: []
}
if (atlas[atlasIndex].website) atlas[atlasIndex].links.website = [atlas[atlasIndex].website]
if (atlas[atlasIndex].subreddit) atlas[atlasIndex].links.subreddit = atlas[atlasIndex].subreddit.split(',').map(subreddit => subreddit.trim().replace(/^\/r\//, ''))
delete atlas[atlasIndex].website
delete atlas[atlasIndex].subreddit
for (const key in currentCenter) {
currentCenter[key] = currentCenter[key].map(int => int + 0.5)
}
atlas[atlasIndex].path = currentPath
atlas[atlasIndex].center = currentCenter
}
return atlas
}

File diff suppressed because one or more lines are too long

View file

@ -358,7 +358,7 @@ <h5 class="modal-title" id="exportModalLabel">Export Entry</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body d-flex flex-column">
<div class="period-status alert alert-warning small py-2" role="alert">We've just released our "remaster" of the new atlas, expect some bugs to show after submitting. If something happens, join our discord!</div>
<div class="period-status alert alert-warning small py-2" role="alert">We've just released our "remaster" of the Atlas. Bugs may happen after submitting. If something happens, tell us on Discord!</div>
<p>Use the Post Direct to Reddit button or manually copy the text below and submit it as a new text post to <a href="https://www.reddit.com/r/placeAtlas2/" target="_blank" rel="noopener noreferrer">r/placeAtlas2</a> on Reddit.</p>
<p>Don't forget to flair it with the <span class="badge rounded-pill bg-primary"><i class="bi bi-tag" aria-hidden="true"></i> <span id="redditFlair">New Entry</span></span> tag.</p>
<p>We will then check it and add it to the atlas.</p>