mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-08-03 02:56:45 -04:00
(nouns) sort after key
This commit is contained in:
parent
52e8147e84
commit
9dad056194
@ -32,6 +32,7 @@ type NounRowWithAuthor = NounRow & { author: User['username'] };
|
||||
export const parseNounRow = (nounRow: NounRow): Omit<NounRaw, 'sourcesData'> => {
|
||||
return {
|
||||
id: nounRow.id,
|
||||
key: nounRow.key,
|
||||
words: JSON.parse(nounRow.words),
|
||||
classInstance: nounRow.classInstance ? JSON.parse(nounRow.classInstance) : null,
|
||||
categories: nounRow.categories?.split('|') ?? [],
|
||||
|
@ -844,6 +844,7 @@ export class PronounLibrary {
|
||||
|
||||
export interface NounRaw {
|
||||
id: string;
|
||||
key?: string | null;
|
||||
words: NounWordsRaw;
|
||||
classInstance?: NounClassInstance | null;
|
||||
categories?: string[];
|
||||
@ -921,6 +922,7 @@ const hasWordOfGender = (words: NounWords, gender: Gender): boolean => {
|
||||
|
||||
export class Noun implements Entry {
|
||||
id: string;
|
||||
key: string;
|
||||
words: NounWords;
|
||||
classInstance: NounClassInstance | null;
|
||||
categories: string[];
|
||||
@ -932,6 +934,7 @@ export class Noun implements Entry {
|
||||
|
||||
constructor(config: Config, nounRaw: NounRawWithLoadedWords) {
|
||||
this.id = nounRaw.id;
|
||||
this.key = nounRaw.key ?? '';
|
||||
this.words = nounRaw.words;
|
||||
this.classInstance = nounRaw.classInstance ?? null;
|
||||
this.categories = nounRaw.categories ?? [];
|
||||
@ -996,7 +999,7 @@ export class Noun implements Entry {
|
||||
if (!this.approved && other.approved) {
|
||||
return -1;
|
||||
}
|
||||
return collator.compare(this.firstWords[0], other.firstWords[0]);
|
||||
return collator.compare(this.key, other.key);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1036,6 +1039,7 @@ export class NounTemplate {
|
||||
|
||||
fill(stem: string): Omit<NounRawWithLoadedWords, 'id'> {
|
||||
return {
|
||||
key: stem,
|
||||
words: {
|
||||
masc: {
|
||||
singular: this.masc.map((e) => ({ spelling: e.replace('-', stem) })),
|
||||
|
Loading…
x
Reference in New Issue
Block a user