@@ -10,6 +10,7 @@ const openProcessingEndpoint = "https://openprocessing.org/api/";
10
10
* Currently a placeholder (https://openprocessing.org/curation/78544/)
11
11
*/
12
12
const curationId = "87649" ;
13
+ const newCurationId = "89576" ;
13
14
14
15
/**
15
16
* API Response from a call to the Curation Sketches endpoint
@@ -43,14 +44,38 @@ export const getCurationSketches = memoize(async (
43
44
limit ?: number ,
44
45
) : Promise < OpenProcessingCurationResponse > => {
45
46
const limitParam = limit ? `limit=${ limit } ` : "" ;
46
- const response = await fetch (
47
+ const response1 = await fetch (
47
48
`${ openProcessingEndpoint } curation/${ curationId } /sketches?${ limitParam } ` ,
48
49
) ;
49
- if ( ! response . ok ) { //log error instead of throwing error to not cache result in memoize
50
- console . error ( 'getCurationSketches' , response . status , response . statusText )
50
+ if ( ! response1 . ok ) { //log error instead of throwing error to not cache result in memoize
51
+ console . error ( 'getCurationSketches' , response1 . status , response1 . statusText )
51
52
}
52
- const payload = await response . json ( ) ;
53
- return payload as OpenProcessingCurationResponse ;
53
+ const payload1 = await response1 . json ( ) ;
54
+
55
+ const response2 = await fetch (
56
+ `${ openProcessingEndpoint } curation/${ newCurationId } /sketches?${ limitParam } ` ,
57
+ ) ;
58
+ if ( ! response2 . ok ) { //log error instead of throwing error to not cache result in memoize
59
+ console . error ( 'getCurationSketches' , response2 . status , response2 . statusText )
60
+ }
61
+ const payload2 = await response2 . json ( ) ;
62
+
63
+ // Selected Sketches from the 2025 curation
64
+ const priorityIds = [ '2690038' , '2484739' , '2688829' , '2689119' , '2690571' , '2690405' , '2684408' , '2693274' , '2693345' , '2691712' ]
65
+
66
+ const prioritySketches = payload2 . filter (
67
+ ( sketch : OpenProcessingCurationResponse [ number ] ) => priorityIds . includes ( String ( sketch . visualID ) ) )
68
+ . sort ( ( a : OpenProcessingCurationResponse [ number ] , b : OpenProcessingCurationResponse [ number ] ) => priorityIds . indexOf ( String ( a . visualID ) ) - priorityIds . indexOf ( String ( b . visualID ) ) ) ;
69
+
70
+
71
+ const finalSketches = [
72
+ ...prioritySketches . map ( ( sketch : OpenProcessingCurationResponse [ number ] ) => ( { ...sketch , curation : '2025' } ) ) ,
73
+ ...payload1 . map ( ( sketch : OpenProcessingCurationResponse [ number ] ) => ( { ...sketch , curation : '2024' } ) ) ,
74
+ ] ;
75
+
76
+ return [
77
+ ...finalSketches ,
78
+ ] as OpenProcessingCurationResponse ;
54
79
} ) ;
55
80
56
81
/**
0 commit comments